@atlaskit/editor-plugin-table 5.3.6 → 5.3.8

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 (87) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +4 -4
  3. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -2
  4. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
  5. package/dist/cjs/plugins/table/types.js +1 -1
  6. package/dist/cjs/plugins/table/ui/DragHandle/index.js +49 -3
  7. package/dist/cjs/plugins/table/ui/DragPreview/index.js +1 -1
  8. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +72 -0
  9. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +20 -3
  10. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +5 -2
  11. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +1 -1
  12. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  13. package/dist/cjs/plugins/table/ui/ui-styles.js +19 -15
  14. package/dist/cjs/plugins/table/utils/decoration.js +3 -24
  15. package/dist/cjs/plugins/table/utils/dom.js +1 -4
  16. package/dist/cjs/plugins/table/utils/index.js +0 -6
  17. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +4 -4
  18. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -2
  19. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
  20. package/dist/es2019/plugins/table/types.js +1 -1
  21. package/dist/es2019/plugins/table/ui/DragHandle/index.js +46 -4
  22. package/dist/es2019/plugins/table/ui/DragPreview/index.js +1 -1
  23. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +60 -0
  24. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +20 -3
  25. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +5 -2
  26. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +1 -1
  27. package/dist/es2019/plugins/table/ui/common-styles.js +2 -5
  28. package/dist/es2019/plugins/table/ui/ui-styles.js +29 -30
  29. package/dist/es2019/plugins/table/utils/decoration.js +3 -24
  30. package/dist/es2019/plugins/table/utils/dom.js +0 -1
  31. package/dist/es2019/plugins/table/utils/index.js +1 -1
  32. package/dist/esm/plugins/table/nodeviews/TableComponent.js +4 -4
  33. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -2
  34. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
  35. package/dist/esm/plugins/table/types.js +1 -1
  36. package/dist/esm/plugins/table/ui/DragHandle/index.js +49 -4
  37. package/dist/esm/plugins/table/ui/DragPreview/index.js +1 -1
  38. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +63 -0
  39. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +20 -3
  40. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +5 -2
  41. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +1 -1
  42. package/dist/esm/plugins/table/ui/common-styles.js +2 -2
  43. package/dist/esm/plugins/table/ui/ui-styles.js +18 -14
  44. package/dist/esm/plugins/table/utils/decoration.js +3 -24
  45. package/dist/esm/plugins/table/utils/dom.js +0 -3
  46. package/dist/esm/plugins/table/utils/index.js +1 -1
  47. package/dist/types/plugins/table/types.d.ts +1 -1
  48. package/dist/types/plugins/table/ui/DragHandle/index.d.ts +3 -1
  49. package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +15 -0
  50. package/dist/types/plugins/table/ui/TableFloatingColumnControls/index.d.ts +3 -0
  51. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
  52. package/dist/types/plugins/table/utils/decoration.d.ts +2 -2
  53. package/dist/types/plugins/table/utils/dom.d.ts +0 -1
  54. package/dist/types/plugins/table/utils/index.d.ts +1 -1
  55. package/dist/types-ts4.5/plugins/table/types.d.ts +1 -1
  56. package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +3 -1
  57. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +15 -0
  58. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/index.d.ts +3 -0
  59. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
  60. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -2
  61. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +0 -1
  62. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
  63. package/package.json +2 -2
  64. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +2 -2
  65. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +84 -34
  66. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +5 -2
  67. package/src/plugins/table/nodeviews/TableComponent.tsx +15 -15
  68. package/src/plugins/table/pm-plugins/decorations/plugin.ts +3 -2
  69. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -1
  70. package/src/plugins/table/types.ts +1 -1
  71. package/src/plugins/table/ui/DragHandle/index.tsx +44 -2
  72. package/src/plugins/table/ui/DragPreview/index.tsx +1 -1
  73. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +100 -0
  74. package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +30 -8
  75. package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -2
  76. package/src/plugins/table/ui/TableFloatingControls/index.tsx +1 -1
  77. package/src/plugins/table/ui/common-styles.ts +2 -4
  78. package/src/plugins/table/ui/ui-styles.ts +30 -30
  79. package/src/plugins/table/utils/decoration.ts +3 -45
  80. package/src/plugins/table/utils/dom.ts +0 -4
  81. package/src/plugins/table/utils/index.ts +0 -1
  82. /package/dist/cjs/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
  83. /package/dist/es2019/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
  84. /package/dist/esm/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
  85. /package/dist/types/plugins/table/ui/{Icons → icons}/DragInMotionIcon.d.ts +0 -0
  86. /package/dist/types-ts4.5/plugins/table/ui/{Icons → icons}/DragInMotionIcon.d.ts +0 -0
  87. /package/src/plugins/table/ui/{Icons → icons}/DragInMotionIcon.tsx +0 -0
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.resizeHandle = exports.insertRowButtonWrapper = exports.insertLine = exports.insertColumnButtonWrapper = exports.hoveredWarningCell = exports.hoveredDeleteButton = exports.hoveredCell = exports.floatingColumnControls = exports.columnControlsLineMarker = exports.columnControlsDecoration = exports.OverflowShadow = exports.InsertMarker = exports.HeaderButtonHover = exports.HeaderButtonDanger = exports.HeaderButton = exports.DeleteButton = void 0;
7
+ exports.rowControlsWrapperDotStyle = exports.resizeHandle = exports.insertRowButtonWrapper = exports.insertLine = exports.insertColumnButtonWrapper = exports.hoveredWarningCell = exports.hoveredDeleteButton = exports.hoveredCell = exports.floatingColumnControls = exports.columnControlsLineMarker = exports.columnControlsDecoration = exports.OverflowShadow = exports.InsertMarker = exports.HeaderButtonHover = exports.HeaderButtonDanger = exports.HeaderButton = exports.DeleteButton = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
@@ -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, _templateObject28, _templateObject29, _templateObject30;
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, _templateObject31;
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
  };
@@ -71,39 +71,43 @@ var getFloatingDotOverrides = function getFloatingDotOverrides(props) {
71
71
  return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n tr\n th:last-child\n .", "::before,\n tr\n td:last-child\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: ", ";\n right: 0px;\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, "var(--ds-space-025, 2px)") : '';
72
72
  };
73
73
  var floatingColumnControls = exports.floatingColumnControls = function floatingColumnControls(props) {
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);
74
+ return (0, _react.css)(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n box-sizing: border-box;\n position: absolute;\n top: 0;\n z-index: -1;\n\n .", " {\n display: flex;\n flex-direction: row;\n }\n }\n\n .", " {\n box-sizing: border-box;\n\n .", " {\n display: grid;\n justify-items: center;\n }\n }\n "])), _types.TableCssClassName.COLUMN_DROP_TARGET_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_INNER, _types.TableCssClassName.COLUMN_CONTROLS_WITH_DRAG, _types.TableCssClassName.COLUMN_CONTROLS_INNER);
75
75
  };
76
- var columnControlsDecoration = exports.columnControlsDecoration = function columnControlsDecoration(props) {
76
+ var rowControlsWrapperDotStyle = exports.rowControlsWrapperDotStyle = function rowControlsWrapperDotStyle(props) {
77
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);
78
+ return (0, _react.css)(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n div.", ">.", "::after {\n display: none;\n }\n "])), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER);
79
+ } else {
80
+ return (0, _react.css)(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\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 "])), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth);
79
81
  }
82
+ };
83
+ var columnControlsDecoration = exports.columnControlsDecoration = function columnControlsDecoration(props) {
80
84
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.column-controls-styles-updated')) {
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));
85
+ return (0, _react.css)(_templateObject22 || (_templateObject22 = (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 .", " .", " {\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.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));
82
86
  } else {
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));
87
+ return (0, _react.css)(_templateObject23 || (_templateObject23 = (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 .", " .", " {\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.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));
84
88
  }
85
89
  };
86
90
  var hoveredDeleteButton = exports.hoveredDeleteButton = function hoveredDeleteButton(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));
91
+ return (0, _react.css)(_templateObject24 || (_templateObject24 = (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));
88
92
  };
89
93
  var hoveredCell = exports.hoveredCell = function hoveredCell(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));
94
+ return (0, _react.css)(_templateObject25 || (_templateObject25 = (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));
91
95
  };
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, ")"));
96
+ var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(_templateObject26 || (_templateObject26 = (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, ")"));
93
97
 
94
98
  // move the resize handle zone completely inside the table cell to avoid overflow
95
99
  var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
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) : '';
100
+ return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject27 || (_templateObject27 = (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
101
  };
98
102
  var resizeHandleOverrides = function resizeHandleOverrides(props) {
99
103
  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);
104
+ return (0, _react.css)(_templateObject28 || (_templateObject28 = (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
105
  }
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);
106
+ return (0, _react.css)(_templateObject29 || (_templateObject29 = (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);
103
107
  };
104
108
  var resizeHandle = exports.resizeHandle = function resizeHandle(props) {
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);
109
+ return (0, _react.css)(_templateObject30 || (_templateObject30 = (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);
106
110
  };
107
111
  var insertLine = exports.insertLine = function insertLine(props) {
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);
112
+ return (0, _react.css)(_templateObject31 || (_templateObject31 = (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);
109
113
  };
@@ -16,7 +16,6 @@ var _utils2 = require("@atlaskit/editor-tables/utils");
16
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
17
  var _types = require("../types");
18
18
  var _ColumnResizeWidget = require("../ui/ColumnResizeWidget");
19
- var _DragHandle = require("../ui/DragHandle");
20
19
  // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
21
20
 
22
21
  var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
@@ -155,30 +154,10 @@ var createColumnSelectedDecoration = exports.createColumnSelectedDecoration = fu
155
154
  });
156
155
  });
157
156
  };
158
- var createColumnControlsDecoration = exports.createColumnControlsDecoration = function createColumnControlsDecoration(selection, hoverLocation) {
159
- // todo: issue here where table may not be selected yet
157
+ var createColumnControlsDecoration = exports.createColumnControlsDecoration = function createColumnControlsDecoration(selection) {
160
158
  var cells = (0, _utils2.getCellsInRow)(0)(selection) || [];
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 () {
166
- var element = document.createElement('div');
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
- return element;
174
- }, {
175
- key: "".concat(_types.TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(colIndex),
176
- // this decoration should be the first one, even before gap cursor.
177
- side: -100,
178
- destroy: function destroy(node) {
179
- _reactDom.default.unmountComponentAtNode(node);
180
- }
181
- })];
159
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
160
+ return [];
182
161
  } else {
183
162
  var index = 0;
184
163
  return cells.map(function (cell) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
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;
6
+ exports.updateResizeHandles = exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowDragControlsButton = 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;
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,6 @@ 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
- };
29
26
  var isRowControlsButton = exports.isRowControlsButton = function isRowControlsButton(node) {
30
27
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_BUTTON) || (0, _utils.containsClassName)(node, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON);
31
28
  };
@@ -231,12 +231,6 @@ 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
- });
240
234
  Object.defineProperty(exports, "isCornerButton", {
241
235
  enumerable: true,
242
236
  get: function get() {
@@ -494,13 +494,13 @@ class TableComponent extends React.Component {
494
494
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
495
495
  stickyHeader: this.state.stickyHeader
496
496
  }));
497
- const colControls = /*#__PURE__*/React.createElement("div", {
498
- className: ClassName.COLUMN_CONTROLS_WRAPPER
499
- }, /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
497
+ const colControls = /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
500
498
  editorView: view,
501
499
  tableRef: tableRef,
502
500
  tableActive: tableActive,
503
501
  hoveredRows: hoveredRows,
502
+ hoveredCell: hoveredCell,
503
+ isResizing: isResizing,
504
504
  ordering: ordering,
505
505
  hasHeaderRow: hasHeaderRow
506
506
  // pass `selection` and `tableHeight` to control re-render
@@ -509,7 +509,7 @@ class TableComponent extends React.Component {
509
509
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
510
510
  stickyHeader: this.state.stickyHeader,
511
511
  getEditorFeatureFlags: this.props.getEditorFeatureFlags
512
- }));
512
+ });
513
513
  const shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
514
514
  const shadowStyle = memoizeOne(visible => ({
515
515
  visibility: visible ? 'visible' : 'hidden'
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { pluginKey as tablePluginKey } from '../plugin-key';
6
7
  import { pluginKey as tableWidthPluginKey } from '../table-width';
7
8
  import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils';
@@ -13,8 +14,8 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
13
14
  const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
14
15
  const changedResizing = isResizing !== wasResizing;
15
16
 
16
- // Remove column controls when resizing
17
- if (isResizing) {
17
+ // Remove column controls when resizing and don't add column decoration controls when DnD enabled
18
+ if (isResizing || getBooleanFF('platform.editor.table.drag-and-drop')) {
18
19
  return DecorationSet.empty;
19
20
  } 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') {
20
21
  return buildColumnControlsDecorations({
@@ -25,7 +25,6 @@ const maybeUpdateColumnControlsDecoration = ({
25
25
  decorationSet,
26
26
  tr
27
27
  }) => {
28
- var _meta$data;
29
28
  const table = findTable(tr.selection);
30
29
  const meta = tr.getMeta(tablePluginKey);
31
30
 
@@ -33,7 +32,7 @@ const maybeUpdateColumnControlsDecoration = ({
33
32
  if (!table && (meta === null || meta === void 0 ? void 0 : meta.type) !== 'HOVER_CELL') {
34
33
  return decorationSet;
35
34
  }
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);
35
+ return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
37
36
  };
38
37
 
39
38
  // @see: https://product-fabric.atlassian.net/browse/ED-7304
@@ -78,7 +78,7 @@ export const TableCssClassName = {
78
78
  CORNER_CONTROLS_INSERT_COLUMN_MARKER: `${tablePrefixSelector}-corner-controls__insert-column-marker`,
79
79
  CONTROLS_CORNER_BUTTON: `${tablePrefixSelector}-corner-button`,
80
80
  /** Controls with drag handle */
81
- COLUMN_CONTROLS_DECORATIONS_WITH_DRAG: `${tablePrefixSelector}-column-controls-decoration-with-drag`,
81
+ COLUMN_CONTROLS_WITH_DRAG: `${tablePrefixSelector}-column-controls-with-drag`,
82
82
  ROW_CONTROLS_WITH_DRAG: `${tablePrefixSelector}-row-controls-with-drag`,
83
83
  DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
84
84
  /** Other classes */
@@ -1,7 +1,10 @@
1
- import React, { useEffect, useRef } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import ReactDOM from 'react-dom';
2
3
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
4
+ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
3
5
  import { N200, N700 } from '@atlaskit/theme/colors';
4
6
  import { TableCssClassName as ClassName } from '../../types';
7
+ import { DragPreview } from '../DragPreview';
5
8
  import { DragHandleIcon } from '../icons/DragHandleIcon';
6
9
  const mapStateToProps = state => {
7
10
  switch (state) {
@@ -21,12 +24,15 @@ export const DragHandle = ({
21
24
  direction = 'row',
22
25
  state = 'default',
23
26
  indexes,
27
+ previewWidth,
28
+ previewHeight,
24
29
  onClick,
25
30
  onMouseOver,
26
31
  onMouseOut
27
32
  }) => {
28
33
  const dragHandleDivRef = useRef(null);
29
34
  const iconProps = mapStateToProps(state);
35
+ const [previewContainer, setPreviewContainer] = useState(null);
30
36
  useEffect(() => {
31
37
  const dragHandleDivRefCurrent = dragHandleDivRef.current;
32
38
  if (dragHandleDivRefCurrent) {
@@ -38,15 +44,51 @@ export const DragHandle = ({
38
44
  type: `table-${direction}`,
39
45
  indexes
40
46
  };
47
+ },
48
+ onGenerateDragPreview: ({
49
+ nativeSetDragImage
50
+ }) => {
51
+ setCustomNativeDragPreview({
52
+ getOffset: ({
53
+ container
54
+ }) => {
55
+ const rect = container.getBoundingClientRect();
56
+ if (direction === 'row') {
57
+ return {
58
+ x: 16,
59
+ y: 16
60
+ };
61
+ } else {
62
+ return {
63
+ x: rect.width / 2 + 16,
64
+ y: 16
65
+ };
66
+ }
67
+ },
68
+ render: function render({
69
+ container
70
+ }) {
71
+ setPreviewContainer(container);
72
+ return () => setPreviewContainer(null);
73
+ },
74
+ nativeSetDragImage
75
+ });
41
76
  }
42
77
  });
43
78
  }
44
79
  }, [tableLocalId, direction, indexes]);
45
80
  return /*#__PURE__*/React.createElement("button", {
46
81
  className: ClassName.DRAG_HANDLE_BUTTON_CONTAINER,
82
+ ref: dragHandleDivRef,
47
83
  style: {
84
+ backgroundColor: `${"var(--ds-surface, white)"}`,
85
+ borderRadius: '4px',
86
+ border: `2px solid ${"var(--ds-surface, white)"}`,
48
87
  transform: direction === 'column' ? 'none' : 'rotate(90deg)'
49
- },
50
- ref: dragHandleDivRef
51
- }, /*#__PURE__*/React.createElement(DragHandleIcon, iconProps));
88
+ }
89
+ }, /*#__PURE__*/React.createElement(DragHandleIcon, iconProps), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
90
+ direction: direction,
91
+ width: previewWidth,
92
+ height: previewHeight
93
+ }), previewContainer));
52
94
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Box, xcss } from '@atlaskit/primitives';
3
- import { DragInMotionIcon } from '../Icons/DragInMotionIcon';
3
+ import { DragInMotionIcon } from '../icons/DragInMotionIcon';
4
4
  const boxStyles = xcss({
5
5
  borderColor: 'color.border.focused',
6
6
  borderStyle: 'solid',
@@ -0,0 +1,60 @@
1
+ import React, { useMemo } from 'react';
2
+ import { TableCssClassName as ClassName } from '../../../types';
3
+ import { getColumnsWidths, getRowHeights } from '../../../utils';
4
+ import { DragHandle } from '../../DragHandle';
5
+ export const ColumnControls = ({
6
+ editorView,
7
+ tableActive,
8
+ tableRef,
9
+ hoveredCell,
10
+ isResizing,
11
+ tableHeight,
12
+ stickyTop,
13
+ localId
14
+ }) => {
15
+ var _rowHeights$;
16
+ const rowHeights = useMemo(() => {
17
+ // NOTE: we don't care so much as to what tableHeight is, we only care that it changed and is a sane value.
18
+ if (tableRef && !!tableHeight) {
19
+ return getRowHeights(tableRef);
20
+ }
21
+ return [0];
22
+ }, [tableRef, tableHeight]);
23
+ if (!tableRef) {
24
+ return null;
25
+ }
26
+ const firstRow = tableRef.querySelector('tr');
27
+ const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
28
+ const marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
29
+ const colWidths = getColumnsWidths(editorView);
30
+ const widths = colWidths.map(width => width ? `${width - 1}px` : '0px').join(' ');
31
+ const colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
32
+ const onClick = (index, event) => {};
33
+ const onMouseOver = () => {};
34
+ const onMouseOut = () => {};
35
+ return /*#__PURE__*/React.createElement("div", {
36
+ className: ClassName.COLUMN_CONTROLS_WITH_DRAG
37
+ }, /*#__PURE__*/React.createElement("div", {
38
+ className: ClassName.COLUMN_CONTROLS_INNER,
39
+ "data-testid": "table-floating-column-controls",
40
+ style: {
41
+ gridTemplateColumns: widths,
42
+ marginTop
43
+ }
44
+ }, tableActive && !isResizing && Number.isFinite(colIndex) && /*#__PURE__*/React.createElement("div", {
45
+ style: {
46
+ gridColumn: `${colIndex + 1} / span 1`,
47
+ marginTop: `-15px`
48
+ },
49
+ "data-column-control-index": colIndex,
50
+ "data-testid": "table-floating-column-control"
51
+ }, /*#__PURE__*/React.createElement(DragHandle, {
52
+ direction: "column",
53
+ indexes: [],
54
+ onClick: event => onClick(colIndex, event),
55
+ onMouseOver: onMouseOver,
56
+ onMouseOut: onMouseOut,
57
+ tableLocalId: localId || ''
58
+ }))));
59
+ };
60
+ export default ColumnControls;
@@ -1,11 +1,16 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
+ import ReactDOM from 'react-dom';
2
3
  import { findTable } from '@atlaskit/editor-tables';
4
+ import { TableCssClassName as ClassName } from '../../types';
5
+ import { ColumnControls } from './ColumnControls';
3
6
  import { ColumnDropTargets } from './ColumnDropTargets';
4
7
  export const TableFloatingColumnControls = ({
5
8
  editorView,
6
9
  tableRef,
7
10
  tableActive,
8
11
  hasHeaderRow,
12
+ hoveredCell,
13
+ isResizing,
9
14
  stickyHeader,
10
15
  selection
11
16
  }) => {
@@ -46,15 +51,27 @@ export const TableFloatingColumnControls = ({
46
51
  return null;
47
52
  }
48
53
  const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
49
- return /*#__PURE__*/React.createElement("div", {
54
+ const mountTo = tableRef && (tableRef === null || tableRef === void 0 ? void 0 : tableRef.parentElement) || document.body;
55
+ return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
56
+ className: ClassName.COLUMN_CONTROLS_WRAPPER
57
+ }, /*#__PURE__*/React.createElement("div", {
50
58
  onMouseDown: e => e.preventDefault(),
51
59
  "data-testid": "table-floating-column-controls-wrapper"
52
- }, tableActive && /*#__PURE__*/React.createElement(ColumnDropTargets, {
60
+ }, /*#__PURE__*/React.createElement(ColumnControls, {
53
61
  editorView: editorView,
62
+ hoveredCell: hoveredCell,
54
63
  tableRef: tableRef,
64
+ isResizing: isResizing,
65
+ tableActive: tableActive,
55
66
  stickyTop: tableActive ? stickyTop : undefined,
56
67
  tableHeight: tableRect.height,
57
68
  localId: selectedLocalId
58
- }));
69
+ }), /*#__PURE__*/React.createElement(ColumnDropTargets, {
70
+ editorView: editorView,
71
+ tableRef: tableRef,
72
+ stickyTop: tableActive ? stickyTop : undefined,
73
+ tableHeight: tableRect.height,
74
+ localId: selectedLocalId
75
+ }))), mountTo);
59
76
  };
60
77
  export default TableFloatingColumnControls;
@@ -14,6 +14,7 @@ const DragControlsComponent = ({
14
14
  }) => {
15
15
  const rowHeights = getRowHeights(tableRef);
16
16
  const heights = rowHeights.map((height, index) => `${height - 1}px`).join(' ');
17
+ const rowWidth = tableRef.offsetWidth;
17
18
  const onClick = (index, event) => {};
18
19
  const onMouseOver = () => {};
19
20
  const onMouseOut = () => {};
@@ -28,7 +29,7 @@ const DragControlsComponent = ({
28
29
  style: {
29
30
  gridTemplateRows: heights
30
31
  }
31
- }, Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
32
+ }, rowIndex !== undefined && Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
32
33
  style: {
33
34
  gridRow: `${rowIndex + 1} / span 1`,
34
35
  display: 'flex'
@@ -38,7 +39,9 @@ const DragControlsComponent = ({
38
39
  onMouseOver: onMouseOver,
39
40
  onMouseOut: onMouseOut,
40
41
  tableLocalId: getLocalId(),
41
- indexes: []
42
+ indexes: [rowIndex],
43
+ previewWidth: rowWidth,
44
+ previewHeight: rowHeights[rowIndex]
42
45
  })));
43
46
  };
44
47
  export const DragControls = injectIntl(DragControlsComponent);
@@ -104,7 +104,7 @@ export default class TableFloatingControls extends Component {
104
104
  }
105
105
  const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
106
106
  return /*#__PURE__*/React.createElement("div", {
107
- onMouseDown: e => e.preventDefault()
107
+ onMouseDown: e => !isDragAndDropEnabled && e.preventDefault()
108
108
  }, isNumberColumnEnabled ? /*#__PURE__*/React.createElement(NumberColumn, {
109
109
  editorView: editorView,
110
110
  hoverRows: this.hoverRows,
@@ -7,7 +7,7 @@ import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
7
7
  import { fontSize } from '@atlaskit/theme/constants';
8
8
  import { TableCssClassName as ClassName } from '../types';
9
9
  import { columnControlsDecorationHeight, resizeHandlerAreaWidth, resizeLineWidth, rowControlsZIndex, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableControlsSpacing, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
10
- import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle } from './ui-styles';
10
+ import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
11
11
  const cornerControlHeight = tableToolbarSize + 1;
12
12
 
13
13
  /*
@@ -487,6 +487,7 @@ export const tableStyles = props => {
487
487
  ${breakoutWidthStyling()}
488
488
 
489
489
  ${columnControlsDecoration(props)};
490
+ ${rowControlsWrapperDotStyle(props)};
490
491
 
491
492
  /* Corner controls */
492
493
  .${ClassName.CORNER_CONTROLS} {
@@ -730,10 +731,6 @@ export const tableStyles = props => {
730
731
  margin-top: 0;
731
732
  }
732
733
 
733
- .${ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG} + * {
734
- margin-top: 0;
735
- }
736
-
737
734
  /*
738
735
  * Headings have a top margin by default, but we don't want this on the
739
736
  * first heading within table header cells.