@atlaskit/editor-plugin-table 5.3.12 → 5.3.14
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.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/plugins/table/event-handlers.js +6 -3
- package/dist/cjs/plugins/table/index.js +16 -2
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -1
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +2 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +22 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +54 -7
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +6 -0
- package/dist/cjs/plugins/table/types.js +9 -2
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +2 -0
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +80 -0
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +62 -0
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +52 -4
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +10 -8
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +12 -3
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +44 -5
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +6 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +44 -20
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +4 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +3 -2
- package/dist/cjs/plugins/table/ui/ui-styles.js +27 -24
- package/dist/cjs/plugins/table/utils/dom.js +12 -4
- package/dist/cjs/plugins/table/utils/drag-menu.js +59 -0
- package/dist/cjs/plugins/table/utils/index.js +12 -0
- package/dist/es2019/plugins/table/event-handlers.js +5 -4
- package/dist/es2019/plugins/table/index.js +16 -2
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +20 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +54 -3
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +7 -0
- package/dist/es2019/plugins/table/types.js +9 -2
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +2 -0
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +77 -0
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +56 -0
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +53 -2
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +10 -8
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +9 -3
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +46 -6
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +45 -22
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +51 -3
- package/dist/es2019/plugins/table/ui/consts.js +2 -1
- package/dist/es2019/plugins/table/ui/ui-styles.js +23 -1
- package/dist/es2019/plugins/table/utils/dom.js +5 -1
- package/dist/es2019/plugins/table/utils/drag-menu.js +44 -0
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +7 -4
- package/dist/esm/plugins/table/index.js +16 -2
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +21 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +54 -7
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +6 -0
- package/dist/esm/plugins/table/types.js +9 -2
- package/dist/esm/plugins/table/ui/DragHandle/index.js +2 -0
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +73 -0
- package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +55 -0
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +51 -3
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +10 -8
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +9 -3
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +45 -6
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +46 -22
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +4 -0
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/consts.js +2 -1
- package/dist/esm/plugins/table/ui/ui-styles.js +26 -23
- package/dist/esm/plugins/table/utils/dom.js +11 -3
- package/dist/esm/plugins/table/utils/drag-menu.js +52 -0
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +8 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +4 -0
- package/dist/types/plugins/table/types.d.ts +10 -2
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +4 -2
- package/dist/types/plugins/table/ui/DragPreview/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingDeleteButton/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingDeleteButton/types.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +19 -0
- package/dist/types/plugins/table/ui/FloatingDragMenu/index.d.ts +21 -0
- package/dist/types/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +6 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +5 -5
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +4 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +3 -0
- package/dist/types/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +4 -1
- package/dist/types/plugins/table/utils/drag-menu.d.ts +7 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +8 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +10 -2
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/table/ui/DragPreview/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +19 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +6 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +5 -5
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +4 -1
- package/dist/types-ts4.5/plugins/table/utils/drag-menu.d.ts +7 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +3 -2
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +40 -194
- package/src/__tests__/unit/ui/RowDragControls.tsx +9 -11
- package/src/plugins/table/event-handlers.ts +15 -3
- package/src/plugins/table/index.tsx +18 -1
- package/src/plugins/table/nodeviews/TableComponent.tsx +2 -1
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +2 -9
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -3
- package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +14 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +32 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +50 -2
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +7 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +5 -0
- package/src/plugins/table/types.ts +14 -2
- package/src/plugins/table/ui/DragHandle/index.tsx +5 -1
- package/src/plugins/table/ui/DragPreview/index.tsx +2 -1
- package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +2 -1
- package/src/plugins/table/ui/FloatingDeleteButton/types.ts +3 -1
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +99 -0
- package/src/plugins/table/ui/FloatingDragMenu/index.tsx +91 -0
- package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +79 -4
- package/src/plugins/table/ui/FloatingInsertButton/getPopupOptions.ts +31 -7
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +28 -13
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +47 -3
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +11 -4
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +65 -25
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +7 -0
- package/src/plugins/table/ui/common-styles.ts +57 -2
- package/src/plugins/table/ui/consts.ts +2 -0
- package/src/plugins/table/ui/ui-styles.ts +27 -1
- package/src/plugins/table/utils/dom.ts +11 -4
- package/src/plugins/table/utils/drag-menu.ts +65 -0
- package/src/plugins/table/utils/index.ts +2 -0
- package/tsconfig.app.json +3 -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.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;
|
|
7
|
+
exports.rowControlsWrapperDotStyle = exports.resizeHandle = exports.insertRowButtonWrapper = exports.insertLine = exports.insertColumnButtonWrapper = exports.hoveredWarningCell = exports.hoveredDeleteButton = exports.hoveredCell = exports.floatingColumnControls = exports.dragInsertButtonWrapper = 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, _templateObject31;
|
|
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, _templateObject32;
|
|
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
|
};
|
|
@@ -42,72 +42,75 @@ var InsertButton = function InsertButton() {
|
|
|
42
42
|
var InsertButtonHover = function InsertButtonHover() {
|
|
43
43
|
return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n .", ":hover {\n background: ", ";\n color: ", ";\n cursor: pointer;\n }\n"])), _types.TableCssClassName.CONTROLS_INSERT_BUTTON, "var(--ds-background-brand-bold, ".concat(_colors.B300, ")"), "var(--ds-icon-inverse, white)");
|
|
44
44
|
};
|
|
45
|
+
var dragInsertButtonWrapper = exports.dragInsertButtonWrapper = function dragInsertButtonWrapper(props) {
|
|
46
|
+
return (0, _react.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n position: absolute;\n z-index: ", ";\n bottom: -5px;\n left: 3px;\n }\n .", " {\n ", "\n }\n .", ":hover {\n background: ", ";\n border: 1px solid ", ";\n color: ", ";\n cursor: pointer;\n }\n"])), _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, _editorSharedStyles.akEditorUnitZIndex + 10, _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON, Button("\n background: ".concat("var(--ds-surface-overlay, white)", ";\n color: ", "var(--ds-icon, ".concat(_colors.N300, ")"), ";\n border: 1px solid ", "var(--ds-background-accent-gray-subtler, #C1C7D0)", ";\n border-radius: 50%;\n ")), _types.TableCssClassName.DRAG_CONTROLS_INSERT_BUTTON, "var(--ds-background-brand-bold, ".concat(_colors.B300, ")"), "var(--ds-background-brand-bold, ".concat(_colors.B300, ")"), "var(--ds-icon-inverse, white)");
|
|
47
|
+
};
|
|
45
48
|
var insertColumnButtonWrapper = exports.insertColumnButtonWrapper = function insertColumnButtonWrapper(props) {
|
|
46
|
-
return (0, _react.css)(
|
|
49
|
+
return (0, _react.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", "\n"])), InsertButton(), InsertButtonHover(), InsertLine(props, "\n width: 2px;\n left: 9px;\n "));
|
|
47
50
|
};
|
|
48
51
|
var insertRowButtonWrapper = exports.insertRowButtonWrapper = function insertRowButtonWrapper(props) {
|
|
49
|
-
return (0, _react.css)(
|
|
52
|
+
return (0, _react.css)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", "\n"])), InsertButton(), InsertButtonHover(), InsertLine(props, "\n height: 2px;\n top: -11px;\n left: ".concat(_consts.tableInsertColumnButtonSize - 1, "px;\n ")));
|
|
50
53
|
};
|
|
51
54
|
var columnControlsLineMarker = exports.columnControlsLineMarker = function columnControlsLineMarker() {
|
|
52
|
-
return (0, _react.css)(
|
|
55
|
+
return (0, _react.css)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n .", ".", "\n table\n tr:first-of-type\n td,\n .", ".", "\n table\n tr:first-of-type\n th {\n position: relative;\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.WITH_CONTROLS);
|
|
53
56
|
};
|
|
54
57
|
var DeleteButton = exports.DeleteButton = function DeleteButton(props) {
|
|
55
|
-
return (0, _react.css)(
|
|
58
|
+
return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n .", ",\n .", " {\n height: ", "px;\n width: ", "px;\n }\n .", " {\n .", " {\n ", "\n }\n }\n\n .", ":hover {\n background: ", ";\n color: ", ";\n cursor: pointer;\n }\n"])), _types.TableCssClassName.CONTROLS_DELETE_BUTTON_WRAP, _types.TableCssClassName.CONTROLS_DELETE_BUTTON, _consts.tableDeleteButtonSize, _consts.tableDeleteButtonSize, _types.TableCssClassName.CONTROLS_DELETE_BUTTON_WRAP, _types.TableCssClassName.CONTROLS_DELETE_BUTTON, Button("\n background: ".concat((0, _consts.tableCellSelectedDeleteIconBackground)(props), ";\n color: ").concat((0, _consts.tableCellSelectedDeleteIconColor)(props), ";\n ")), _types.TableCssClassName.CONTROLS_DELETE_BUTTON, (0, _consts.tableCellHoverDeleteIconBackground)(props), (0, _consts.tableCellHoverDeleteIconColor)(props));
|
|
56
59
|
};
|
|
57
60
|
var OverflowShadow = exports.OverflowShadow = function OverflowShadow(props) {
|
|
58
|
-
return (0, _react.css)(
|
|
61
|
+
return (0, _react.css)(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n .", ", .", " {\n display: block;\n height: calc(100% - ", "px);\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: ", "px;\n }\n .", " {\n background: linear-gradient(\n to left,\n transparent 0,\n ", "\n ", "%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n transparent 0,\n ", "\n ", "%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: ", ";\n }\n .", " {\n .", ", .", " {\n height: calc(100% - ", "px);\n top: ", "px;\n }\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _styles.tableMarginTop, _styles.tableMarginTop, _editorSharedStyles.akEditorShadowZIndex, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ? _consts.tableOverflowShadowWidthWide : _consts.tableOverflowShadowWidth, _types.TableCssClassName.TABLE_LEFT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ? 140 : 100, "var(--ds-shadow-overflow-perimeter, transparent)", _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, _types.TableCssClassName.TABLE_RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ? 140 : 100, "var(--ds-shadow-overflow-perimeter, transparent)", (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? "calc(100% - ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ? _consts.tableOverflowShadowWidthWide : _consts.tableOverflowShadowWidth, "px)") : "calc(100% - ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ? _consts.tableOverflowShadowWidthWide - 10 : -2, "px)"), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _styles.tableMarginTopWithControl, _styles.tableMarginTopWithControl, _types.TableCssClassName.TABLE_LEFT_SHADOW, (0, _consts.tableBorderColor)(props));
|
|
59
62
|
};
|
|
60
63
|
var columnHeaderButton = function columnHeaderButton(props, cssString) {
|
|
61
64
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.column-controls-styles-updated')) {
|
|
62
|
-
return (0, _react.css)(
|
|
65
|
+
return (0, _react.css)(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n display: block;\n box-sizing: border-box;\n padding: 0;\n\n :focus {\n outline: none;\n }\n\n ", "\n "])), (0, _consts.tableHeaderCellBackgroundColor)(props), cssString);
|
|
63
66
|
} else {
|
|
64
|
-
return (0, _react.css)(
|
|
67
|
+
return (0, _react.css)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border: 1px solid ", ";\n display: block;\n box-sizing: border-box;\n padding: 0;\n\n :focus {\n outline: none;\n }\n\n ", "\n "])), (0, _consts.tableHeaderCellBackgroundColor)(props), (0, _consts.tableBorderColor)(props), cssString);
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
70
|
var columnHeaderButtonSelected = function columnHeaderButtonSelected(props) {
|
|
68
|
-
return (0, _react.css)(
|
|
71
|
+
return (0, _react.css)(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n"])), "var(--ds-text-inverse, ".concat(_colors.N0, ")"), (0, _consts.tableToolbarSelectedColor)(props), (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsSelectedZIndex);
|
|
69
72
|
};
|
|
70
73
|
var getFloatingDotOverrides = function getFloatingDotOverrides(props) {
|
|
71
|
-
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(
|
|
74
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject19 || (_templateObject19 = (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
75
|
};
|
|
73
76
|
var floatingColumnControls = exports.floatingColumnControls = function floatingColumnControls(props) {
|
|
74
|
-
return (0, _react.css)(
|
|
77
|
+
return (0, _react.css)(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n box-sizing: border-box;\n position: absolute;\n top: 0;\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.DRAG_COLUMN_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_INNER);
|
|
75
78
|
};
|
|
76
79
|
var rowControlsWrapperDotStyle = exports.rowControlsWrapperDotStyle = function rowControlsWrapperDotStyle(props) {
|
|
77
80
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
|
|
78
|
-
return (0, _react.css)(
|
|
81
|
+
return (0, _react.css)(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\n div.", ">.", "::after {\n display: none;\n }\n "])), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER);
|
|
79
82
|
} else {
|
|
80
|
-
return (0, _react.css)(
|
|
83
|
+
return (0, _react.css)(_templateObject22 || (_templateObject22 = (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);
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
86
|
var columnControlsDecoration = exports.columnControlsDecoration = function columnControlsDecoration(props) {
|
|
84
87
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.column-controls-styles-updated')) {
|
|
85
|
-
return (0, _react.css)(
|
|
88
|
+
return (0, _react.css)(_templateObject23 || (_templateObject23 = (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));
|
|
86
89
|
} else {
|
|
87
|
-
return (0, _react.css)(
|
|
90
|
+
return (0, _react.css)(_templateObject24 || (_templateObject24 = (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));
|
|
88
91
|
}
|
|
89
92
|
};
|
|
90
93
|
var hoveredDeleteButton = exports.hoveredDeleteButton = function hoveredDeleteButton(props) {
|
|
91
|
-
return (0, _react.css)(
|
|
94
|
+
return (0, _react.css)(_templateObject25 || (_templateObject25 = (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));
|
|
92
95
|
};
|
|
93
96
|
var hoveredCell = exports.hoveredCell = function hoveredCell(props) {
|
|
94
|
-
return (0, _react.css)(
|
|
97
|
+
return (0, _react.css)(_templateObject26 || (_templateObject26 = (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));
|
|
95
98
|
};
|
|
96
|
-
var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(
|
|
99
|
+
var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(_templateObject27 || (_templateObject27 = (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, ")"));
|
|
97
100
|
|
|
98
101
|
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
99
102
|
var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
|
|
100
|
-
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(
|
|
103
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject28 || (_templateObject28 = (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) : '';
|
|
101
104
|
};
|
|
102
105
|
var resizeHandleOverrides = function resizeHandleOverrides(props) {
|
|
103
106
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
|
|
104
|
-
return (0, _react.css)(
|
|
107
|
+
return (0, _react.css)(_templateObject29 || (_templateObject29 = (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);
|
|
105
108
|
}
|
|
106
|
-
return (0, _react.css)(
|
|
109
|
+
return (0, _react.css)(_templateObject30 || (_templateObject30 = (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);
|
|
107
110
|
};
|
|
108
111
|
var resizeHandle = exports.resizeHandle = function resizeHandle(props) {
|
|
109
|
-
return (0, _react.css)(
|
|
112
|
+
return (0, _react.css)(_templateObject31 || (_templateObject31 = (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);
|
|
110
113
|
};
|
|
111
114
|
var insertLine = exports.insertLine = function insertLine(props) {
|
|
112
|
-
return (0, _react.css)(
|
|
115
|
+
return (0, _react.css)(_templateObject32 || (_templateObject32 = (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);
|
|
113
116
|
};
|
|
@@ -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.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.isDragRowFloatingInsertDot = exports.isDragColumnFloatingInsertDot = 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");
|
|
@@ -26,9 +26,6 @@ var isColumnControlsDecorations = exports.isColumnControlsDecorations = function
|
|
|
26
26
|
var isRowControlsButton = exports.isRowControlsButton = function isRowControlsButton(node) {
|
|
27
27
|
return (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_BUTTON) || (0, _utils.containsClassName)(node, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON);
|
|
28
28
|
};
|
|
29
|
-
var isRowDragControlsButton = exports.isRowDragControlsButton = function isRowDragControlsButton(node) {
|
|
30
|
-
return (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_WITH_DRAG) || (0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.ROW_CONTROLS_WITH_DRAG));
|
|
31
|
-
};
|
|
32
29
|
var isResizeHandleDecoration = exports.isResizeHandleDecoration = function isResizeHandleDecoration(node) {
|
|
33
30
|
return (0, _utils.containsClassName)(node, _types.TableCssClassName.RESIZE_HANDLE_DECORATION);
|
|
34
31
|
};
|
|
@@ -39,6 +36,17 @@ var isTableContainerOrWrapper = exports.isTableContainerOrWrapper = function isT
|
|
|
39
36
|
return (0, _utils.containsClassName)(node, _types.TableCssClassName.TABLE_CONTAINER) || (0, _utils.containsClassName)(node, _types.TableCssClassName.TABLE_NODE_WRAPPER);
|
|
40
37
|
};
|
|
41
38
|
|
|
39
|
+
/** drag-and-drop classes */
|
|
40
|
+
var isRowDragControlsButton = exports.isRowDragControlsButton = function isRowDragControlsButton(node) {
|
|
41
|
+
return (0, _utils.containsClassName)(node, _types.TableCssClassName.DRAG_ROW_CONTROLS) || (0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.DRAG_ROW_CONTROLS));
|
|
42
|
+
};
|
|
43
|
+
var isDragRowFloatingInsertDot = exports.isDragRowFloatingInsertDot = function isDragRowFloatingInsertDot(node) {
|
|
44
|
+
return (0, _utils.containsClassName)(node, _types.TableCssClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER);
|
|
45
|
+
};
|
|
46
|
+
var isDragColumnFloatingInsertDot = exports.isDragColumnFloatingInsertDot = function isDragColumnFloatingInsertDot(node) {
|
|
47
|
+
return (0, _utils.containsClassName)(node, _types.TableCssClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER);
|
|
48
|
+
};
|
|
49
|
+
|
|
42
50
|
/*
|
|
43
51
|
* This function returns which side of a given element the mouse cursor is,
|
|
44
52
|
* using as a base the half of the width by default, for example:
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getDragMenuConfig = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _commands = require("../pm-plugins/drag-and-drop/commands");
|
|
10
|
+
var canDecrease = function canDecrease(index) {
|
|
11
|
+
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
12
|
+
return index !== undefined && index > min;
|
|
13
|
+
};
|
|
14
|
+
var canIncrease = function canIncrease(index) {
|
|
15
|
+
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
16
|
+
return index !== undefined && index < max;
|
|
17
|
+
};
|
|
18
|
+
var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(direction, tableMap, index) {
|
|
19
|
+
var moveOptions = direction === 'row' ? [{
|
|
20
|
+
label: 'up',
|
|
21
|
+
offset: -1,
|
|
22
|
+
canMove: canDecrease
|
|
23
|
+
}, {
|
|
24
|
+
label: 'down',
|
|
25
|
+
offset: 1,
|
|
26
|
+
canMove: function canMove(index) {
|
|
27
|
+
var _tableMap$height;
|
|
28
|
+
return canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
29
|
+
}
|
|
30
|
+
}] : [{
|
|
31
|
+
label: 'left',
|
|
32
|
+
offset: -1,
|
|
33
|
+
canMove: canDecrease
|
|
34
|
+
}, {
|
|
35
|
+
label: 'right',
|
|
36
|
+
offset: 1,
|
|
37
|
+
canMove: function canMove(index) {
|
|
38
|
+
var _tableMap$width;
|
|
39
|
+
return canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
40
|
+
}
|
|
41
|
+
}];
|
|
42
|
+
return (0, _toConsumableArray2.default)(moveOptions.map(function (_ref) {
|
|
43
|
+
var label = _ref.label,
|
|
44
|
+
offset = _ref.offset,
|
|
45
|
+
canMove = _ref.canMove;
|
|
46
|
+
return {
|
|
47
|
+
id: "move_".concat(direction, "_").concat(label),
|
|
48
|
+
title: "Move ".concat(direction, " ").concat(label),
|
|
49
|
+
disabled: !canMove(index),
|
|
50
|
+
onClick: function onClick(state, dispatch) {
|
|
51
|
+
if (canMove(index)) {
|
|
52
|
+
(0, _commands.moveSource)("table-".concat(direction), index, index + offset)(state, dispatch);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
@@ -237,6 +237,18 @@ Object.defineProperty(exports, "isCornerButton", {
|
|
|
237
237
|
return _dom.isCornerButton;
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
|
+
Object.defineProperty(exports, "isDragColumnFloatingInsertDot", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function get() {
|
|
243
|
+
return _dom.isDragColumnFloatingInsertDot;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "isDragRowFloatingInsertDot", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function get() {
|
|
249
|
+
return _dom.isDragRowFloatingInsertDot;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
240
252
|
Object.defineProperty(exports, "isInsertRowButton", {
|
|
241
253
|
enumerable: true,
|
|
242
254
|
get: function get() {
|
|
@@ -9,11 +9,12 @@ 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';
|
|
11
11
|
import { RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
|
|
12
|
-
import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
|
|
12
|
+
import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
|
|
13
13
|
import { getAllowAddColumnCustomStep } from './utils/get-allow-add-column-custom-step';
|
|
14
14
|
const isFocusingCalendar = event => event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.getAttribute('aria-label') === 'calendar';
|
|
15
15
|
const isFocusingModal = event => event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[role="dialog"]');
|
|
16
16
|
const isFocusingFloatingToolbar = event => event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[role="toolbar"]');
|
|
17
|
+
const isFocusingDragHandles = event => event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.getAttribute('draggable') === 'true';
|
|
17
18
|
export const handleBlur = (view, event) => {
|
|
18
19
|
const {
|
|
19
20
|
state,
|
|
@@ -21,7 +22,7 @@ export const handleBlur = (view, event) => {
|
|
|
21
22
|
} = view;
|
|
22
23
|
// IE version check for ED-4665
|
|
23
24
|
// Calendar focus check for ED-10466
|
|
24
|
-
if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event)) {
|
|
25
|
+
if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event)) {
|
|
25
26
|
setEditorFocus(false)(state, dispatch);
|
|
26
27
|
}
|
|
27
28
|
event.preventDefault();
|
|
@@ -191,7 +192,7 @@ export const handleMouseMove = (view, event, elementContentRects) => {
|
|
|
191
192
|
return false;
|
|
192
193
|
}
|
|
193
194
|
const element = event.target;
|
|
194
|
-
if (isColumnControlsDecorations(element)) {
|
|
195
|
+
if (isColumnControlsDecorations(element) || isDragColumnFloatingInsertDot(element)) {
|
|
195
196
|
const {
|
|
196
197
|
state,
|
|
197
198
|
dispatch
|
|
@@ -205,7 +206,7 @@ export const handleMouseMove = (view, event, elementContentRects) => {
|
|
|
205
206
|
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
|
-
if (isRowControlsButton(element)) {
|
|
209
|
+
if (isRowControlsButton(element) || isDragRowFloatingInsertDot(element)) {
|
|
209
210
|
const {
|
|
210
211
|
state,
|
|
211
212
|
dispatch
|
|
@@ -28,6 +28,7 @@ import { getToolbarConfig } from './toolbar';
|
|
|
28
28
|
import FloatingContextualButton from './ui/FloatingContextualButton';
|
|
29
29
|
import FloatingContextualMenu from './ui/FloatingContextualMenu';
|
|
30
30
|
import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
31
|
+
import FloatingDragMenu from './ui/FloatingDragMenu';
|
|
31
32
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
32
33
|
import LayoutButton from './ui/LayoutButton';
|
|
33
34
|
import { isLayoutSupported } from './utils';
|
|
@@ -242,7 +243,8 @@ const tablesPlugin = ({
|
|
|
242
243
|
tableResizingPluginState: resizingPluginState,
|
|
243
244
|
stickyHeadersState,
|
|
244
245
|
tablePluginState,
|
|
245
|
-
tableWidthPluginState
|
|
246
|
+
tableWidthPluginState,
|
|
247
|
+
dragAndDropState
|
|
246
248
|
}) => {
|
|
247
249
|
const {
|
|
248
250
|
state
|
|
@@ -262,6 +264,7 @@ const tablesPlugin = ({
|
|
|
262
264
|
insertRowButtonIndex,
|
|
263
265
|
isHeaderColumnEnabled,
|
|
264
266
|
isHeaderRowEnabled,
|
|
267
|
+
isDragAndDropEnabled,
|
|
265
268
|
tableWrapperTarget
|
|
266
269
|
} = tablePluginState;
|
|
267
270
|
const {
|
|
@@ -298,6 +301,7 @@ const tablesPlugin = ({
|
|
|
298
301
|
insertRowButtonIndex: insertRowButtonIndex,
|
|
299
302
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
300
303
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
304
|
+
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
301
305
|
editorView: editorView,
|
|
302
306
|
mountPoint: popupsMountPoint,
|
|
303
307
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -316,7 +320,17 @@ const tablesPlugin = ({
|
|
|
316
320
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
317
321
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
318
322
|
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
319
|
-
}),
|
|
323
|
+
}), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
|
|
324
|
+
editorView: editorView,
|
|
325
|
+
mountPoint: popupsMountPoint,
|
|
326
|
+
boundariesElement: popupsBoundariesElement,
|
|
327
|
+
tableRef: tableRef,
|
|
328
|
+
tableNode: tableNode,
|
|
329
|
+
targetCellPosition: targetCellPosition,
|
|
330
|
+
direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
|
|
331
|
+
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
332
|
+
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing
|
|
333
|
+
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
320
334
|
editorView: editorView,
|
|
321
335
|
selection: editorView.state.selection,
|
|
322
336
|
tableRef: tableRef,
|
|
@@ -477,6 +477,7 @@ class TableComponent extends React.Component {
|
|
|
477
477
|
}, /*#__PURE__*/React.createElement(TableFloatingControls, {
|
|
478
478
|
editorView: view,
|
|
479
479
|
tableRef: tableRef,
|
|
480
|
+
tableNode: node,
|
|
480
481
|
tableActive: tableActive,
|
|
481
482
|
hoveredRows: hoveredRows,
|
|
482
483
|
hoveredCell: hoveredCell,
|
|
@@ -484,7 +485,7 @@ class TableComponent extends React.Component {
|
|
|
484
485
|
isResizing: isResizing,
|
|
485
486
|
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
|
|
486
487
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
487
|
-
isDragAndDropEnabled:
|
|
488
|
+
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
488
489
|
ordering: ordering,
|
|
489
490
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
490
491
|
hasHeaderRow: hasHeaderRow
|
|
@@ -9,7 +9,7 @@ import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecora
|
|
|
9
9
|
export const pluginKey = new PluginKey('tableDecorationsPlugin');
|
|
10
10
|
export const getDecorations = state => pluginKey.getState(state);
|
|
11
11
|
export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newState) => {
|
|
12
|
-
var _tableWidthPluginKey$, _tableWidthPluginKey$2
|
|
12
|
+
var _tableWidthPluginKey$, _tableWidthPluginKey$2;
|
|
13
13
|
const isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
14
14
|
const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
|
|
15
15
|
const changedResizing = isResizing !== wasResizing;
|
|
@@ -17,7 +17,7 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
|
|
|
17
17
|
// Remove column controls when resizing and don't add column decoration controls when DnD enabled
|
|
18
18
|
if (isResizing || getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
19
19
|
return DecorationSet.empty;
|
|
20
|
-
} else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing
|
|
20
|
+
} else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing) {
|
|
21
21
|
return buildColumnControlsDecorations({
|
|
22
22
|
decorationSet,
|
|
23
23
|
tr
|
|
@@ -38,16 +38,12 @@ export const createPlugin = () => {
|
|
|
38
38
|
state: {
|
|
39
39
|
init: () => DecorationSet.empty,
|
|
40
40
|
apply: (tr, decorationSet, oldState, newState) => {
|
|
41
|
-
var _tablePluginKey$getSt, _tablePluginKey$getSt2;
|
|
42
41
|
let pluginState = decorationSet;
|
|
43
42
|
const meta = tr.getMeta(tablePluginKey);
|
|
44
|
-
const previousHover = (_tablePluginKey$getSt = tablePluginKey.getState(oldState)) === null || _tablePluginKey$getSt === void 0 ? void 0 : _tablePluginKey$getSt.hoveredCell;
|
|
45
|
-
const newHover = (_tablePluginKey$getSt2 = tablePluginKey.getState(newState)) === null || _tablePluginKey$getSt2 === void 0 ? void 0 : _tablePluginKey$getSt2.hoveredCell;
|
|
46
|
-
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);
|
|
47
43
|
if (meta && meta.data && meta.data.decorationSet) {
|
|
48
44
|
pluginState = meta.data.decorationSet;
|
|
49
45
|
}
|
|
50
|
-
if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)
|
|
46
|
+
if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)) {
|
|
51
47
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
52
48
|
return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
|
|
53
49
|
}
|
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
import { composeDecorations } from './compose-decorations';
|
|
9
8
|
const isColumnSelected = tr => tr.selection instanceof CellSelection && tr.selection.isColSelection();
|
|
10
9
|
|
|
@@ -26,10 +25,9 @@ const maybeUpdateColumnControlsDecoration = ({
|
|
|
26
25
|
tr
|
|
27
26
|
}) => {
|
|
28
27
|
const table = findTable(tr.selection);
|
|
29
|
-
const meta = tr.getMeta(tablePluginKey);
|
|
30
28
|
|
|
31
29
|
// avoid re-drawing state if dnd decorations don't need to be updated
|
|
32
|
-
if (!table
|
|
30
|
+
if (!table) {
|
|
33
31
|
return decorationSet;
|
|
34
32
|
}
|
|
35
33
|
return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
|
|
@@ -67,4 +67,24 @@ export const moveSource = (sourceType, sourceIndex, targetIndex) => createComman
|
|
|
67
67
|
const newTr = move(sourceIndex, targetIndex)(tr);
|
|
68
68
|
const select = isTableRow ? selectRow : selectColumn;
|
|
69
69
|
return select(targetIndex)(newTr);
|
|
70
|
+
});
|
|
71
|
+
export const toggleDragMenu = (isDragMenuOpen, direction, index) => createCommand(state => {
|
|
72
|
+
let {
|
|
73
|
+
isDragMenuOpen: previousOpenState,
|
|
74
|
+
dragMenuDirection,
|
|
75
|
+
dragMenuIndex
|
|
76
|
+
} = getPluginState(state);
|
|
77
|
+
if (previousOpenState === isDragMenuOpen) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
type: DragAndDropActionType.TOGGLE_DRAG_MENU,
|
|
82
|
+
data: {
|
|
83
|
+
isDragMenuOpen: isDragMenuOpen === undefined ? !previousOpenState : isDragMenuOpen,
|
|
84
|
+
direction: direction !== null && direction !== void 0 ? direction : dragMenuDirection,
|
|
85
|
+
index: index !== null && index !== void 0 ? index : dragMenuIndex
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}, tr => {
|
|
89
|
+
return tr.setMeta('addToHistory', false);
|
|
70
90
|
});
|