@atlaskit/editor-plugin-table 5.3.1 → 5.3.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 (161) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/commands/hover.js +17 -8
  3. package/dist/cjs/plugins/table/commands/index.js +6 -0
  4. package/dist/cjs/plugins/table/commands/misc.js +1 -7
  5. package/dist/cjs/plugins/table/event-handlers.js +29 -2
  6. package/dist/cjs/plugins/table/index.js +1 -1
  7. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -3
  8. package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
  9. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +7 -3
  10. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
  11. package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +14 -1
  12. package/dist/cjs/plugins/table/pm-plugins/main.js +5 -5
  13. package/dist/cjs/plugins/table/reducer.js +2 -1
  14. package/dist/cjs/plugins/table/types.js +6 -0
  15. package/dist/cjs/plugins/table/ui/DragHandle/index.js +50 -0
  16. package/dist/cjs/plugins/table/ui/DragPreview/index.js +39 -0
  17. package/dist/cjs/plugins/table/ui/Icons/DragInMotionIcon.js +55 -0
  18. package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +53 -14
  19. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +114 -0
  20. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +53 -0
  21. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +11 -106
  22. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +16 -6
  23. package/dist/cjs/plugins/table/ui/common-styles.js +9 -6
  24. package/dist/cjs/plugins/table/ui/consts.js +2 -1
  25. package/dist/cjs/plugins/table/ui/ui-styles.js +18 -9
  26. package/dist/cjs/plugins/table/utils/decoration.js +44 -18
  27. package/dist/cjs/plugins/table/utils/dom.js +7 -1
  28. package/dist/cjs/plugins/table/utils/index.js +12 -0
  29. package/dist/es2019/plugins/table/commands/hover.js +12 -8
  30. package/dist/es2019/plugins/table/commands/index.js +1 -1
  31. package/dist/es2019/plugins/table/commands/misc.js +1 -7
  32. package/dist/es2019/plugins/table/event-handlers.js +28 -2
  33. package/dist/es2019/plugins/table/index.js +1 -1
  34. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -3
  35. package/dist/es2019/plugins/table/nodeviews/table.js +4 -2
  36. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +8 -6
  37. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
  38. package/dist/es2019/plugins/table/pm-plugins/default-table-selection.js +13 -0
  39. package/dist/es2019/plugins/table/pm-plugins/main.js +6 -5
  40. package/dist/es2019/plugins/table/reducer.js +2 -1
  41. package/dist/es2019/plugins/table/types.js +6 -0
  42. package/dist/es2019/plugins/table/ui/DragHandle/index.js +41 -0
  43. package/dist/es2019/plugins/table/ui/DragPreview/index.js +33 -0
  44. package/dist/es2019/plugins/table/ui/Icons/DragInMotionIcon.js +47 -0
  45. package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -10
  46. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +86 -0
  47. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +43 -0
  48. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -88
  49. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +17 -7
  50. package/dist/es2019/plugins/table/ui/common-styles.js +47 -12
  51. package/dist/es2019/plugins/table/ui/consts.js +1 -0
  52. package/dist/es2019/plugins/table/ui/ui-styles.js +57 -14
  53. package/dist/es2019/plugins/table/utils/decoration.js +44 -18
  54. package/dist/es2019/plugins/table/utils/dom.js +2 -0
  55. package/dist/es2019/plugins/table/utils/index.js +1 -1
  56. package/dist/esm/plugins/table/commands/hover.js +16 -8
  57. package/dist/esm/plugins/table/commands/index.js +1 -1
  58. package/dist/esm/plugins/table/commands/misc.js +1 -7
  59. package/dist/esm/plugins/table/event-handlers.js +29 -2
  60. package/dist/esm/plugins/table/index.js +1 -1
  61. package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -3
  62. package/dist/esm/plugins/table/nodeviews/table.js +4 -2
  63. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +8 -6
  64. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
  65. package/dist/esm/plugins/table/pm-plugins/default-table-selection.js +13 -0
  66. package/dist/esm/plugins/table/pm-plugins/main.js +7 -7
  67. package/dist/esm/plugins/table/reducer.js +2 -1
  68. package/dist/esm/plugins/table/types.js +6 -0
  69. package/dist/esm/plugins/table/ui/DragHandle/index.js +41 -0
  70. package/dist/esm/plugins/table/ui/DragPreview/index.js +32 -0
  71. package/dist/esm/plugins/table/ui/Icons/DragInMotionIcon.js +48 -0
  72. package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -15
  73. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +104 -0
  74. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +46 -0
  75. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -104
  76. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +17 -7
  77. package/dist/esm/plugins/table/ui/common-styles.js +10 -7
  78. package/dist/esm/plugins/table/ui/consts.js +1 -0
  79. package/dist/esm/plugins/table/ui/ui-styles.js +18 -9
  80. package/dist/esm/plugins/table/utils/decoration.js +44 -18
  81. package/dist/esm/plugins/table/utils/dom.js +6 -0
  82. package/dist/esm/plugins/table/utils/index.js +1 -1
  83. package/dist/types/plugins/table/commands/hover.d.ts +2 -1
  84. package/dist/types/plugins/table/commands/index.d.ts +1 -1
  85. package/dist/types/plugins/table/event-handlers.d.ts +1 -0
  86. package/dist/types/plugins/table/nodeviews/types.d.ts +4 -3
  87. package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
  88. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
  89. package/dist/types/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
  90. package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
  91. package/dist/types/plugins/table/types.d.ts +16 -1
  92. package/dist/types/plugins/table/ui/DragHandle/index.d.ts +11 -0
  93. package/dist/types/plugins/table/ui/DragPreview/index.d.ts +6 -0
  94. package/dist/types/plugins/table/ui/Icons/DragInMotionIcon.d.ts +6 -0
  95. package/dist/types/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
  96. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
  97. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
  98. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
  99. package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
  100. package/dist/types/plugins/table/ui/consts.d.ts +1 -0
  101. package/dist/types/plugins/table/utils/decoration.d.ts +2 -2
  102. package/dist/types/plugins/table/utils/dom.d.ts +2 -0
  103. package/dist/types/plugins/table/utils/index.d.ts +1 -1
  104. package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +2 -1
  105. package/dist/types-ts4.5/plugins/table/commands/index.d.ts +1 -1
  106. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -0
  107. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +4 -3
  108. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
  109. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
  110. package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
  111. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
  112. package/dist/types-ts4.5/plugins/table/types.d.ts +16 -1
  113. package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +11 -0
  114. package/dist/types-ts4.5/plugins/table/ui/DragPreview/index.d.ts +6 -0
  115. package/dist/types-ts4.5/plugins/table/ui/Icons/DragInMotionIcon.d.ts +6 -0
  116. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
  117. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
  118. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
  119. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
  120. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
  121. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
  122. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -2
  123. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +2 -0
  124. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
  125. package/package.json +5 -3
  126. package/src/__tests__/unit/event-handlers.ts +74 -1
  127. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +35 -15
  128. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +146 -42
  129. package/src/__tests__/unit/ui/NumberColumn.tsx +148 -0
  130. package/src/__tests__/unit/ui/RowControls.tsx +4 -4
  131. package/src/__tests__/unit/ui/RowDragControls.tsx +118 -0
  132. package/src/__tests__/unit/ui/TableFloatingControls.tsx +9 -5
  133. package/src/plugins/table/commands/hover.ts +16 -7
  134. package/src/plugins/table/commands/index.ts +1 -0
  135. package/src/plugins/table/commands/misc.ts +0 -5
  136. package/src/plugins/table/event-handlers.ts +49 -2
  137. package/src/plugins/table/index.tsx +1 -1
  138. package/src/plugins/table/nodeviews/TableComponent.tsx +3 -2
  139. package/src/plugins/table/nodeviews/table.tsx +2 -0
  140. package/src/plugins/table/nodeviews/types.ts +4 -3
  141. package/src/plugins/table/pm-plugins/decorations/plugin.ts +13 -4
  142. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +10 -5
  143. package/src/plugins/table/pm-plugins/default-table-selection.ts +10 -0
  144. package/src/plugins/table/pm-plugins/main.ts +9 -4
  145. package/src/plugins/table/reducer.ts +2 -1
  146. package/src/plugins/table/types.ts +14 -2
  147. package/src/plugins/table/ui/DragHandle/index.tsx +57 -0
  148. package/src/plugins/table/ui/DragPreview/index.tsx +45 -0
  149. package/src/plugins/table/ui/Icons/DragInMotionIcon.tsx +60 -0
  150. package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +68 -30
  151. package/src/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.tsx +129 -0
  152. package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +75 -0
  153. package/src/plugins/table/ui/TableFloatingControls/RowControls/index.tsx +2 -135
  154. package/src/plugins/table/ui/TableFloatingControls/index.tsx +43 -24
  155. package/src/plugins/table/ui/common-styles.ts +52 -11
  156. package/src/plugins/table/ui/consts.ts +1 -0
  157. package/src/plugins/table/ui/ui-styles.ts +58 -14
  158. package/src/plugins/table/utils/decoration.ts +75 -27
  159. package/src/plugins/table/utils/dom.ts +8 -0
  160. package/src/plugins/table/utils/index.ts +2 -0
  161. package/tsconfig.app.json +6 -0
@@ -14,7 +14,7 @@ var _colors = require("@atlaskit/theme/colors");
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
  var _types = require("../types");
16
16
  var _consts = require("./consts");
17
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27;
17
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30;
18
18
  var InsertLine = function InsertLine(props, cssString) {
19
19
  return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n background: ", ";\n display: none;\n position: absolute;\n z-index: ", ";\n ", "\n }\n"])), _types.TableCssClassName.CONTROLS_INSERT_LINE, (0, _consts.tableBorderSelectedColor)(props), _editorSharedStyles.akEditorUnitZIndex, cssString);
20
20
  };
@@ -74,27 +74,36 @@ var floatingColumnControls = exports.floatingColumnControls = function floatingC
74
74
  return (0, _react.css)(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n box-sizing: border-box;\n position: absolute;\n\n .", " {\n display: flex;\n flex-direction: row;\n }\n }\n "])), _types.TableCssClassName.COLUMN_DROP_TARGET_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_INNER);
75
75
  };
76
76
  var columnControlsDecoration = exports.columnControlsDecoration = function columnControlsDecoration(props) {
77
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
78
+ return (0, _react.css)(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n position: absolute;\n // kinda a hacky way to center an element with absolute positioning inside a relative element\n top: 25%;\n left: 50%;\n transform: translate(-50%, -100%);\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG);
79
+ }
77
80
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.column-controls-styles-updated')) {
78
- return (0, _react.css)(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 100%;\n left: 0;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-top: ").concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-bottom: ").concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n box-sizing: content-box;\n height: ").concat(_consts.tableToolbarSize - 1, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _styles.tableCellBorderWidth, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _styles.tableCellBorderWidth, (0, _consts.tableBorderDeleteColor)(props), _styles.tableCellBorderWidth, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
81
+ return (0, _react.css)(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 100%;\n left: 0;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-top: ").concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-bottom: ").concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n box-sizing: content-box;\n height: ").concat(_consts.tableToolbarSize - 1, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _styles.tableCellBorderWidth, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _styles.tableCellBorderWidth, (0, _consts.tableBorderDeleteColor)(props), _styles.tableCellBorderWidth, _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
79
82
  } else {
80
- return (0, _react.css)(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _styles.tableCellBorderWidth * 2, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-bottom: none;\n height: ").concat(_consts.tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
83
+ return (0, _react.css)(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _styles.tableCellBorderWidth * 2, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-bottom: none;\n height: ").concat(_consts.tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
81
84
  }
82
85
  };
83
86
  var hoveredDeleteButton = exports.hoveredDeleteButton = function hoveredDeleteButton(props) {
84
- return (0, _react.css)(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2.default)(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderDeleteColor)(props), _types.TableCssClassName.SELECTED_CELL, (0, _consts.tableCellDeleteColor)(props));
87
+ return (0, _react.css)(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2.default)(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderDeleteColor)(props), _types.TableCssClassName.SELECTED_CELL, (0, _consts.tableCellDeleteColor)(props));
85
88
  };
86
89
  var hoveredCell = exports.hoveredCell = function hoveredCell(props) {
87
- return (0, _react.css)(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderSelectedColor)(props));
90
+ return (0, _react.css)(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderSelectedColor)(props));
88
91
  };
89
- var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL_WARNING, "var(--ds-background-warning, ".concat(_colors.Y50, ")"), "var(--ds-border-warning, ".concat(_colors.Y200, ")"));
92
+ var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(_templateObject25 || (_templateObject25 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL_WARNING, "var(--ds-background-warning, ".concat(_colors.Y50, ")"), "var(--ds-border-warning, ".concat(_colors.Y200, ")"));
90
93
 
91
94
  // move the resize handle zone completely inside the table cell to avoid overflow
92
95
  var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
93
- return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject25 || (_templateObject25 = (0, _taggedTemplateLiteral2.default)(["\n tr\n th:last-child\n .", ",\n tr\n td:last-child\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: 0;\n cursor: col-resize;\n z-index: ", ";\n }\n "])), _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth / 2, _consts.resizeHandlerZIndex) : '';
96
+ return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2.default)(["\n tr\n th:last-child\n .", ",\n tr\n td:last-child\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: 0;\n cursor: col-resize;\n z-index: ", ";\n }\n "])), _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth / 2, _consts.resizeHandlerZIndex) : '';
97
+ };
98
+ var resizeHandleOverrides = function resizeHandleOverrides(props) {
99
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
100
+ return (0, _react.css)(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2.default)(["\n th.", "::before,\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before,\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n "])), _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2);
101
+ }
102
+ return (0, _react.css)(_templateObject28 || (_templateObject28 = (0, _taggedTemplateLiteral2.default)(["\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n "])), _types.TableCssClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth);
94
103
  };
95
104
  var resizeHandle = exports.resizeHandle = function resizeHandle(props) {
96
- return (0, _react.css)(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n ", "\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth, _consts.resizeHandlerAreaWidth / 2, _consts.resizeHandlerZIndex, getLastColumnResizerOverrides(), _types.TableCssClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth);
105
+ return (0, _react.css)(_templateObject29 || (_templateObject29 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n ", "\n\n ", "\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth, _consts.resizeHandlerAreaWidth / 2, _consts.resizeHandlerZIndex, getLastColumnResizerOverrides(), resizeHandleOverrides(props), _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth);
97
106
  };
98
107
  var insertLine = exports.insertLine = function insertLine(props) {
99
- return (0, _react.css)(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -1px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n bottom: 0;\n height: ", "px;\n width: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n bottom: 0;\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2);
108
+ return (0, _react.css)(_templateObject30 || (_templateObject30 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -1px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n bottom: 0;\n height: ", "px;\n width: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n bottom: 0;\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE, _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2);
100
109
  };
@@ -13,8 +13,10 @@ var _utils = require("@atlaskit/editor-common/utils");
13
13
  var _view = require("@atlaskit/editor-prosemirror/view");
14
14
  var _tableMap = require("@atlaskit/editor-tables/table-map");
15
15
  var _utils2 = require("@atlaskit/editor-tables/utils");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _types = require("../types");
17
18
  var _ColumnResizeWidget = require("../ui/ColumnResizeWidget");
19
+ var _DragHandle = require("../ui/DragHandle");
18
20
  // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
19
21
 
20
22
  var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
@@ -153,30 +155,54 @@ var createColumnSelectedDecoration = exports.createColumnSelectedDecoration = fu
153
155
  });
154
156
  });
155
157
  };
156
- var createColumnControlsDecoration = exports.createColumnControlsDecoration = function createColumnControlsDecoration(selection) {
158
+ var createColumnControlsDecoration = exports.createColumnControlsDecoration = function createColumnControlsDecoration(selection, hoverLocation) {
159
+ // todo: issue here where table may not be selected yet
157
160
  var cells = (0, _utils2.getCellsInRow)(0)(selection) || [];
158
- var index = 0;
159
- return cells.map(function (cell) {
160
- var colspan = cell.node.attrs.colspan || 1;
161
- // It's important these values are scoped locally as the widget callback could be executed anytime in the future
162
- // and we want to avoid value leak
163
- var startIndex = index;
164
- var endIndex = startIndex + colspan;
165
-
166
- // The next cell start index will commence from the current cell end index.
167
- index = endIndex;
168
- return _view.Decoration.widget(cell.pos + 1, function () {
161
+ var table = (0, _utils2.findTable)(selection);
162
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop') && hoverLocation && !Number.isNaN(hoverLocation === null || hoverLocation === void 0 ? void 0 : hoverLocation.colIndex) && table) {
163
+ var colIndex = hoverLocation.colIndex;
164
+ var cell = cells[colIndex];
165
+ return [_view.Decoration.widget(cell.pos + 1, function () {
169
166
  var element = document.createElement('div');
170
- element.classList.add(_types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS);
171
- element.dataset.startIndex = "".concat(startIndex);
172
- element.dataset.endIndex = "".concat(endIndex);
167
+ element.classList.add(_types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG);
168
+ _reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_DragHandle.DragHandle, {
169
+ tableLocalId: table.node.attrs.localId,
170
+ direction: 'column',
171
+ indexes: [colIndex]
172
+ }), element);
173
173
  return element;
174
174
  }, {
175
- key: "".concat(_types.TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(endIndex),
175
+ key: "".concat(_types.TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(colIndex),
176
176
  // this decoration should be the first one, even before gap cursor.
177
- side: -100
177
+ side: -100,
178
+ destroy: function destroy(node) {
179
+ _reactDom.default.unmountComponentAtNode(node);
180
+ }
181
+ })];
182
+ } else {
183
+ var index = 0;
184
+ return cells.map(function (cell) {
185
+ var colspan = cell.node.attrs.colspan || 1;
186
+ // It's important these values are scoped locally as the widget callback could be executed anytime in the future
187
+ // and we want to avoid value leak
188
+ var startIndex = index;
189
+ var endIndex = startIndex + colspan;
190
+
191
+ // The next cell start index will commence from the current cell end index.
192
+ index = endIndex;
193
+ return _view.Decoration.widget(cell.pos + 1, function () {
194
+ var element = document.createElement('div');
195
+ element.classList.add(_types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS);
196
+ element.dataset.startIndex = "".concat(startIndex);
197
+ element.dataset.endIndex = "".concat(endIndex);
198
+ return element;
199
+ }, {
200
+ key: "".concat(_types.TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(endIndex),
201
+ // this decoration should be the first one, even before gap cursor.
202
+ side: -100
203
+ });
178
204
  });
179
- });
205
+ }
180
206
  };
181
207
  var updateDecorations = exports.updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
182
208
  var filteredDecorations = filterDecorationByKey(key, decorationSet);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.updateResizeHandles = exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isCornerButton = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getTree = exports.getTop = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = void 0;
6
+ exports.updateResizeHandles = exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowDragControlsButton = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isCornerButton = exports.isColumnDragControlsDecorations = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getTree = exports.getTop = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  var _types = require("../types");
9
9
  var _consts = require("../ui/consts");
@@ -23,9 +23,15 @@ var getColumnOrRowIndex = exports.getColumnOrRowIndex = function getColumnOrRowI
23
23
  var isColumnControlsDecorations = exports.isColumnControlsDecorations = function isColumnControlsDecorations(node) {
24
24
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS);
25
25
  };
26
+ var isColumnDragControlsDecorations = exports.isColumnDragControlsDecorations = function isColumnDragControlsDecorations(node) {
27
+ return (0, _utils.containsClassName)(node, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG) || (0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG));
28
+ };
26
29
  var isRowControlsButton = exports.isRowControlsButton = function isRowControlsButton(node) {
27
30
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_BUTTON) || (0, _utils.containsClassName)(node, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON);
28
31
  };
32
+ var isRowDragControlsButton = exports.isRowDragControlsButton = function isRowDragControlsButton(node) {
33
+ return (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_WITH_DRAG) || (0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.ROW_CONTROLS_WITH_DRAG));
34
+ };
29
35
  var isResizeHandleDecoration = exports.isResizeHandleDecoration = function isResizeHandleDecoration(node) {
30
36
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.RESIZE_HANDLE_DECORATION);
31
37
  };
@@ -231,6 +231,12 @@ Object.defineProperty(exports, "isColumnDeleteButtonVisible", {
231
231
  return _columnControls.isColumnDeleteButtonVisible;
232
232
  }
233
233
  });
234
+ Object.defineProperty(exports, "isColumnDragControlsDecorations", {
235
+ enumerable: true,
236
+ get: function get() {
237
+ return _dom.isColumnDragControlsDecorations;
238
+ }
239
+ });
234
240
  Object.defineProperty(exports, "isCornerButton", {
235
241
  enumerable: true,
236
242
  get: function get() {
@@ -273,6 +279,12 @@ Object.defineProperty(exports, "isRowDeleteButtonVisible", {
273
279
  return _rowControls.isRowDeleteButtonVisible;
274
280
  }
275
281
  });
282
+ Object.defineProperty(exports, "isRowDragControlsButton", {
283
+ enumerable: true,
284
+ get: function get() {
285
+ return _dom.isRowDragControlsButton;
286
+ }
287
+ });
276
288
  Object.defineProperty(exports, "isSelectionUpdated", {
277
289
  enumerable: true,
278
290
  get: function get() {
@@ -4,13 +4,7 @@ import { findTable, getCellsInColumn, getCellsInRow } from '@atlaskit/editor-tab
4
4
  import { createCommand } from '../pm-plugins/plugin-factory';
5
5
  import { TableDecorations } from '../types';
6
6
  import { createCellHoverDecoration, createColumnLineResize, createControlsHoverDecoration, getMergedCellsPositions, updatePluginStateDecorations } from '../utils';
7
- // #endregion
8
-
9
- // #region Utils
10
7
  const makeArray = n => Array.from(Array(n).keys());
11
- // #endregion
12
-
13
- // #region Commands
14
8
  export const hoverMergedCells = () => createCommand(state => {
15
9
  const mergedCellsPositions = getMergedCellsPositions(state.tr);
16
10
  if (!mergedCellsPositions.length) {
@@ -27,7 +21,7 @@ export const hoverMergedCells = () => createCommand(state => {
27
21
  }));
28
22
  const decorations = createCellHoverDecoration(mergedCells);
29
23
  return {
30
- type: 'HOVER_CELLS',
24
+ type: 'HOVER_MERGED_CELLS',
31
25
  data: {
32
26
  decorationSet: updatePluginStateDecorations(state, decorations, TableDecorations.CELL_CONTROLS_HOVER)
33
27
  }
@@ -105,4 +99,14 @@ export const hideResizeHandleLine = () => createCommand(state => ({
105
99
  decorationSet: updatePluginStateDecorations(state, [], TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
106
100
  }
107
101
  }));
108
- // #endregion
102
+ export const hoverCell = (rowIndex, colIndex) => createCommand(() => {
103
+ return {
104
+ type: 'HOVER_CELL',
105
+ data: {
106
+ hoveredCell: {
107
+ rowIndex,
108
+ colIndex
109
+ }
110
+ }
111
+ };
112
+ }, tr => tr.setMeta('addToHistory', false));
@@ -1,4 +1,4 @@
1
- export { hoverColumns, hoverRows, hoverTable, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine } from './hover';
1
+ export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine } from './hover';
2
2
  export { insertColumn, insertRow, createTable } from './insert';
3
3
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
4
4
  export { clearMultipleCells } from './clear';
@@ -13,11 +13,6 @@ import { TableCssClassName as ClassName, TableDecorations } from '../types';
13
13
  import { createColumnControlsDecoration, createColumnSelectedDecoration } from '../utils/decoration';
14
14
  import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isIsolating } from '../utils/nodes';
15
15
  import { updatePluginStateDecorations } from '../utils/update-plugin-state-decorations';
16
- // #endregion
17
-
18
- // #endregion
19
-
20
- // #region Commands
21
16
  export const setEditorFocus = editorHasFocus => createCommand({
22
17
  type: 'SET_EDITOR_FOCUS',
23
18
  data: {
@@ -419,5 +414,4 @@ export const addBoldInEmptyHeaderCells = tableCellHeader => (state, dispatch) =>
419
414
  return true;
420
415
  }
421
416
  return false;
422
- };
423
- // #endregion
417
+ };
@@ -4,7 +4,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
7
- import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
7
+ import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
8
8
  import { getPluginState } from './pm-plugins/plugin-factory';
9
9
  import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
10
10
  import { deleteColumns, deleteRows } from './transforms';
@@ -171,12 +171,16 @@ export const handleMouseLeave = (view, event) => {
171
171
  } = view;
172
172
  const {
173
173
  insertColumnButtonIndex,
174
- insertRowButtonIndex
174
+ insertRowButtonIndex,
175
+ isDragAndDropEnabled
175
176
  } = getPluginState(state);
176
177
  const target = event.target;
177
178
  if (isTableControlsButton(target)) {
178
179
  return true;
179
180
  }
181
+ if (isDragAndDropEnabled) {
182
+ hoverCell(undefined, undefined)(state, dispatch);
183
+ }
180
184
  if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && hideInsertColumnOrRowButton()(state, dispatch)) {
181
185
  return true;
182
186
  }
@@ -326,4 +330,26 @@ export const whenTableInFocus = (eventHandler, elementContentRects) => (view, mo
326
330
  return false;
327
331
  }
328
332
  return eventHandler(view, mouseEvent, elementContentRects);
333
+ };
334
+ const trackCellLocation = (view, mouseEvent) => {
335
+ const target = mouseEvent.target;
336
+ const maybeTableCell = isElementInTableCell(target);
337
+ if (!maybeTableCell) {
338
+ return;
339
+ }
340
+ const colIndex = maybeTableCell.cellIndex;
341
+ const rowElement = closestElement(target, 'tr');
342
+ const rowIndex = rowElement && rowElement.rowIndex;
343
+ const {
344
+ hoveredCell
345
+ } = getPluginState(view.state);
346
+ if (hoveredCell.colIndex !== colIndex || hoveredCell.rowIndex !== rowIndex) {
347
+ hoverCell(rowIndex, colIndex)(view.state, view.dispatch);
348
+ }
349
+ };
350
+ export const withCellTracking = (eventHandler, elementContentRects) => (view, mouseEvent) => {
351
+ if (getPluginState(view.state).isDragAndDropEnabled) {
352
+ trackCellLocation(view, mouseEvent);
353
+ }
354
+ return eventHandler(view, mouseEvent, elementContentRects);
329
355
  };
@@ -106,7 +106,7 @@ const tablesPlugin = ({
106
106
  getEditorFeatureFlags,
107
107
  dragAndDropEnabled
108
108
  } = options || {};
109
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api);
109
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api);
110
110
  }
111
111
  }, {
112
112
  name: 'tablePMColResizing',
@@ -466,7 +466,8 @@ class TableComponent extends React.Component {
466
466
  // doesn't work well with WithPluginState
467
467
  const {
468
468
  isInDanger,
469
- hoveredRows
469
+ hoveredRows,
470
+ hoveredCell
470
471
  } = getPluginState(view.state);
471
472
  const tableRef = this.table || undefined;
472
473
  const headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
@@ -478,10 +479,12 @@ class TableComponent extends React.Component {
478
479
  tableRef: tableRef,
479
480
  tableActive: tableActive,
480
481
  hoveredRows: hoveredRows,
482
+ hoveredCell: hoveredCell,
481
483
  isInDanger: isInDanger,
482
484
  isResizing: isResizing,
483
485
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
484
486
  isHeaderRowEnabled: isHeaderRowEnabled,
487
+ isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
485
488
  ordering: ordering,
486
489
  isHeaderColumnEnabled: isHeaderColumnEnabled,
487
490
  hasHeaderRow: hasHeaderRow
@@ -489,8 +492,7 @@ class TableComponent extends React.Component {
489
492
  ,
490
493
  selection: view.state.selection,
491
494
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
492
- stickyHeader: this.state.stickyHeader,
493
- getEditorFeatureFlags: this.props.getEditorFeatureFlags
495
+ stickyHeader: this.state.stickyHeader
494
496
  }));
495
497
  const colControls = /*#__PURE__*/React.createElement("div", {
496
498
  className: ClassName.COLUMN_CONTROLS_WRAPPER
@@ -223,7 +223,8 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
223
223
  isBreakoutEnabled,
224
224
  isFullWidthModeEnabled,
225
225
  wasFullWidthModeEnabled,
226
- isTableResizingEnabled
226
+ isTableResizingEnabled,
227
+ isDragAndDropEnabled
227
228
  } = getPluginState(view.state);
228
229
  const {
229
230
  allowColumnResizing
@@ -240,7 +241,8 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
240
241
  isBreakoutEnabled,
241
242
  isFullWidthModeEnabled,
242
243
  wasFullWidthModeEnabled,
243
- isTableResizingEnabled
244
+ isTableResizingEnabled,
245
+ isDragAndDropEnabled
244
246
  },
245
247
  getEditorContainerWidth,
246
248
  getEditorFeatureFlags,
@@ -1,7 +1,5 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey
3
- // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
4
- } from '@atlaskit/editor-prosemirror/state';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
5
  import { pluginKey as tablePluginKey } from '../plugin-key';
@@ -10,7 +8,7 @@ import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecora
10
8
  export const pluginKey = new PluginKey('tableDecorationsPlugin');
11
9
  export const getDecorations = state => pluginKey.getState(state);
12
10
  export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newState) => {
13
- var _tableWidthPluginKey$, _tableWidthPluginKey$2;
11
+ var _tableWidthPluginKey$, _tableWidthPluginKey$2, _tr$getMeta;
14
12
  const isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
15
13
  const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
16
14
  const changedResizing = isResizing !== wasResizing;
@@ -18,7 +16,7 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
18
16
  // Remove column controls when resizing
19
17
  if (isResizing) {
20
18
  return DecorationSet.empty;
21
- } else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing) {
19
+ } else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing || ((_tr$getMeta = tr.getMeta(tablePluginKey)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.type) === 'HOVER_CELL') {
22
20
  return buildColumnControlsDecorations({
23
21
  decorationSet,
24
22
  tr
@@ -39,12 +37,16 @@ export const createPlugin = () => {
39
37
  state: {
40
38
  init: () => DecorationSet.empty,
41
39
  apply: (tr, decorationSet, oldState, newState) => {
40
+ var _tablePluginKey$getSt, _tablePluginKey$getSt2;
42
41
  let pluginState = decorationSet;
43
42
  const meta = tr.getMeta(tablePluginKey);
43
+ const previousHover = (_tablePluginKey$getSt = tablePluginKey.getState(oldState)) === null || _tablePluginKey$getSt === void 0 ? void 0 : _tablePluginKey$getSt.hoveredCell;
44
+ const newHover = (_tablePluginKey$getSt2 = tablePluginKey.getState(newState)) === null || _tablePluginKey$getSt2 === void 0 ? void 0 : _tablePluginKey$getSt2.hoveredCell;
45
+ const changedCellHover = (previousHover === null || previousHover === void 0 ? void 0 : previousHover.colIndex) !== (newHover === null || newHover === void 0 ? void 0 : newHover.colIndex) || (previousHover === null || previousHover === void 0 ? void 0 : previousHover.rowIndex) !== (newHover === null || newHover === void 0 ? void 0 : newHover.rowIndex);
44
46
  if (meta && meta.data && meta.data.decorationSet) {
45
47
  pluginState = meta.data.decorationSet;
46
48
  }
47
- if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)) {
49
+ if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey) || changedCellHover) {
48
50
  pluginState = pluginState.map(tr.mapping, tr.doc);
49
51
  return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
50
52
  }
@@ -4,6 +4,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
4
  import { findTable } from '@atlaskit/editor-tables/utils';
5
5
  import { TableDecorations } from '../../../types';
6
6
  import { createColumnControlsDecoration, createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../../utils/decoration';
7
+ import { pluginKey as tablePluginKey } from '../../plugin-key';
7
8
  import { composeDecorations } from './compose-decorations';
8
9
  const isColumnSelected = tr => tr.selection instanceof CellSelection && tr.selection.isColSelection();
9
10
 
@@ -24,11 +25,15 @@ const maybeUpdateColumnControlsDecoration = ({
24
25
  decorationSet,
25
26
  tr
26
27
  }) => {
28
+ var _meta$data;
27
29
  const table = findTable(tr.selection);
28
- if (!table) {
30
+ const meta = tr.getMeta(tablePluginKey);
31
+
32
+ // avoid re-drawing state if dnd decorations don't need to be updated
33
+ if (!table && (meta === null || meta === void 0 ? void 0 : meta.type) !== 'HOVER_CELL') {
29
34
  return decorationSet;
30
35
  }
31
- return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
36
+ return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection, meta === null || meta === void 0 ? void 0 : (_meta$data = meta.data) === null || _meta$data === void 0 ? void 0 : _meta$data.hoveredCell), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
32
37
  };
33
38
 
34
39
  // @see: https://product-fabric.atlassian.net/browse/ED-7304
@@ -1,4 +1,17 @@
1
1
  export const defaultTableSelection = {
2
2
  hoveredColumns: [],
3
3
  hoveredRows: []
4
+ };
5
+
6
+ /**
7
+ * Creating a separate object for hoveredCell so it doesn't get defaulted when `handleDocOrSelectionChanged` runs.
8
+ *
9
+ * It is safe to persist this value as it gets removed when the mouse cursor leaves the table, so no need to remove it
10
+ * when doc changes.
11
+ */
12
+ export const defaultHoveredCell = {
13
+ hoveredCell: {
14
+ rowIndex: undefined,
15
+ colIndex: undefined
16
+ }
4
17
  };
@@ -8,7 +8,7 @@ import { findTable } from '@atlaskit/editor-tables/utils';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
10
10
  import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
11
- import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus } from '../event-handlers';
11
+ import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
12
12
  import { createTableView } from '../nodeviews/table';
13
13
  import TableCell from '../nodeviews/TableCell';
14
14
  import TableRow from '../nodeviews/TableRow';
@@ -17,10 +17,10 @@ import { fixTables, replaceSelectedTable } from '../transforms';
17
17
  import { TableCssClassName as ClassName } from '../types';
18
18
  import { findControlsHoverDecoration, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, updateResizeHandles } from '../utils';
19
19
  import { isHeaderRowRequired } from '../utils/paste';
20
- import { defaultTableSelection } from './default-table-selection';
20
+ import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
21
21
  import { createPluginState, getPluginState } from './plugin-factory';
22
22
  import { pluginKey } from './plugin-key';
23
- export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
23
+ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
24
24
  var _window;
25
25
  const state = createPluginState(dispatch, {
26
26
  pluginConfig,
@@ -33,6 +33,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
33
33
  isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
34
34
  isHeaderColumnEnabled: false,
35
35
  isDragAndDropEnabled: dragAndDropEnabled,
36
+ ...defaultHoveredCell,
36
37
  ...defaultTableSelection,
37
38
  getIntl
38
39
  });
@@ -234,8 +235,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
234
235
  handleDOMEvents: {
235
236
  focus: handleFocus,
236
237
  blur: handleBlur,
237
- mousedown: handleMouseDown,
238
- mouseover: whenTableInFocus(handleMouseOver),
238
+ mousedown: withCellTracking(handleMouseDown),
239
+ mouseover: whenTableInFocus(withCellTracking(handleMouseOver)),
239
240
  mouseleave: whenTableInFocus(handleMouseLeave),
240
241
  mouseout: whenTableInFocus(handleMouseOut),
241
242
  mousemove: whenTableInFocus(handleMouseMove, elementContentRects),
@@ -114,7 +114,8 @@ export default ((pluginState, action) => {
114
114
  case 'HOVER_ROWS':
115
115
  case 'HOVER_COLUMNS':
116
116
  case 'HOVER_TABLE':
117
- case 'HOVER_CELLS':
117
+ case 'HOVER_MERGED_CELLS':
118
+ case 'HOVER_CELL':
118
119
  case 'SHOW_RESIZE_HANDLE_LINE':
119
120
  case 'SET_EDITOR_FOCUS':
120
121
  return {