@atlaskit/editor-plugin-table 5.3.25 → 5.3.27
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 +14 -0
- package/dist/cjs/plugins/table/commands/hover.js +9 -3
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/cjs/plugins/table/types.js +3 -0
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +16 -4
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +2 -1
- package/dist/cjs/plugins/table/ui/icons/DragHandleDisabledIcon.js +45 -0
- package/dist/cjs/plugins/table/ui/icons/index.js +7 -0
- package/dist/cjs/plugins/table/ui/ui-styles.js +12 -9
- package/dist/cjs/plugins/table/utils/decoration.js +7 -1
- package/dist/es2019/plugins/table/commands/hover.js +13 -4
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/es2019/plugins/table/types.js +3 -0
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +19 -6
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +27 -1
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +30 -38
- package/dist/es2019/plugins/table/ui/consts.js +1 -0
- package/dist/es2019/plugins/table/ui/icons/DragHandleDisabledIcon.js +37 -0
- package/dist/es2019/plugins/table/ui/icons/index.js +1 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +13 -1
- package/dist/es2019/plugins/table/utils/decoration.js +7 -1
- package/dist/esm/plugins/table/commands/hover.js +10 -4
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/esm/plugins/table/types.js +3 -0
- package/dist/esm/plugins/table/ui/DragHandle/index.js +18 -6
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/consts.js +1 -0
- package/dist/esm/plugins/table/ui/icons/DragHandleDisabledIcon.js +38 -0
- package/dist/esm/plugins/table/ui/icons/index.js +1 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +12 -9
- package/dist/esm/plugins/table/utils/decoration.js +7 -1
- package/dist/types/plugins/table/types.d.ts +3 -0
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +3 -1
- package/dist/types/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types/plugins/table/ui/icons/DragHandleDisabledIcon.d.ts +6 -0
- package/dist/types/plugins/table/ui/icons/index.d.ts +1 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/plugins/table/utils/selection.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/DragHandleDisabledIcon.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/index.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/decoration.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +2 -2
- package/package.json +2 -2
- package/src/plugins/table/commands/hover.ts +12 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +31 -7
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -1
- package/src/plugins/table/types.ts +4 -0
- package/src/plugins/table/ui/DragHandle/index.tsx +36 -5
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +33 -1
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -0
- package/src/plugins/table/ui/common-styles.ts +33 -40
- package/src/plugins/table/ui/consts.ts +6 -0
- package/src/plugins/table/ui/icons/DragHandleDisabledIcon.tsx +53 -0
- package/src/plugins/table/ui/icons/index.ts +1 -0
- package/src/plugins/table/ui/ui-styles.ts +13 -0
- package/src/plugins/table/utils/decoration.ts +14 -0
- package/src/plugins/table/utils/selection.ts +6 -2
- package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +0 -612
- package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +0 -820
- package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -120
- package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -120
- package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -229
- package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -239
- package/src/__tests__/integration/__snapshots__/resize.ts.snap +0 -2685
- package/src/__tests__/integration/__snapshots__/scale.ts.snap +0 -1085
- package/src/__tests__/integration/arrow-down-into-table.ts +0 -50
- package/src/__tests__/integration/auto-size.ts +0 -92
- package/src/__tests__/integration/cell-selection.ts +0 -105
- package/src/__tests__/integration/delete-columns.ts +0 -99
- package/src/__tests__/integration/delete-last-column-in-full-width.ts +0 -73
- package/src/__tests__/integration/delete-last-column-with-empty-action.ts +0 -60
- package/src/__tests__/integration/delete-last-row-with-empty-action.ts +0 -99
- package/src/__tests__/integration/insert-row-inside-layout.ts +0 -52
- package/src/__tests__/integration/resize.ts +0 -333
- package/src/__tests__/integration/scale.ts +0 -70
|
@@ -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.dragInsertButtonWrapper = exports.dragCornerControlButton = 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.dragCornerControlButton = exports.disabledCell = 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, _templateObject32, _templateObject33;
|
|
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, _templateObject33, _templateObject34;
|
|
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
|
};
|
|
@@ -96,24 +96,27 @@ var columnControlsDecoration = exports.columnControlsDecoration = function colum
|
|
|
96
96
|
var hoveredDeleteButton = exports.hoveredDeleteButton = function hoveredDeleteButton(props) {
|
|
97
97
|
return (0, _react.css)(_templateObject26 || (_templateObject26 = (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));
|
|
98
98
|
};
|
|
99
|
+
var disabledCell = exports.disabledCell = function disabledCell(props) {
|
|
100
|
+
return (0, _react.css)(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n .", ".", " {\n position: relative;\n border: 1px solid ", ";\n }\n .", ".", "::after {\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.HOVERED_DISABLED_CELL, _consts.tableCellDisabledColor, _types.TableCssClassName.HOVERED_CELL, _types.TableCssClassName.HOVERED_DISABLED_CELL, _consts.tableCellDisabledColor);
|
|
101
|
+
};
|
|
99
102
|
var hoveredCell = exports.hoveredCell = function hoveredCell(props) {
|
|
100
|
-
return (0, _react.css)(
|
|
103
|
+
return (0, _react.css)(_templateObject28 || (_templateObject28 = (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));
|
|
101
104
|
};
|
|
102
|
-
var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(
|
|
105
|
+
var hoveredWarningCell = exports.hoveredWarningCell = (0, _react.css)(_templateObject29 || (_templateObject29 = (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, ")"));
|
|
103
106
|
|
|
104
107
|
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
105
108
|
var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
|
|
106
|
-
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(
|
|
109
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject30 || (_templateObject30 = (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) : '';
|
|
107
110
|
};
|
|
108
111
|
var resizeHandleOverrides = function resizeHandleOverrides(props) {
|
|
109
112
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
|
|
110
|
-
return (0, _react.css)(
|
|
113
|
+
return (0, _react.css)(_templateObject31 || (_templateObject31 = (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);
|
|
111
114
|
}
|
|
112
|
-
return (0, _react.css)(
|
|
115
|
+
return (0, _react.css)(_templateObject32 || (_templateObject32 = (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);
|
|
113
116
|
};
|
|
114
117
|
var resizeHandle = exports.resizeHandle = function resizeHandle(props) {
|
|
115
|
-
return (0, _react.css)(
|
|
118
|
+
return (0, _react.css)(_templateObject33 || (_templateObject33 = (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);
|
|
116
119
|
};
|
|
117
120
|
var insertLine = exports.insertLine = function insertLine(props) {
|
|
118
|
-
return (0, _react.css)(
|
|
121
|
+
return (0, _react.css)(_templateObject34 || (_templateObject34 = (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);
|
|
119
122
|
};
|
|
@@ -16,6 +16,7 @@ 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 _mergedCells = require("./merged-cells");
|
|
19
20
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
20
21
|
|
|
21
22
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
@@ -38,7 +39,7 @@ var createCellHoverDecoration = exports.createCellHoverDecoration = function cre
|
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
};
|
|
41
|
-
var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, danger, selected) {
|
|
42
|
+
var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
|
|
42
43
|
var table = (0, _utils2.findTable)(tr.selection);
|
|
43
44
|
if (!table) {
|
|
44
45
|
return [];
|
|
@@ -65,6 +66,8 @@ var createControlsHoverDecoration = exports.createControlsHoverDecoration = func
|
|
|
65
66
|
var updatedCells = cells.map(function (x) {
|
|
66
67
|
return x.pos;
|
|
67
68
|
});
|
|
69
|
+
var hasMergedCells = type === 'row' ? (0, _mergedCells.hasMergedCellsInRow)(hoveredIndexes[0])(tr.selection) : (0, _mergedCells.hasMergedCellsInColumn)(hoveredIndexes[0])(tr.selection);
|
|
70
|
+
var disabled = hasMergedCells;
|
|
68
71
|
|
|
69
72
|
// ED-15246 fixed trello card table overflow issue
|
|
70
73
|
// If columns / rows have been merged the hovered selection is different to the actual selection
|
|
@@ -115,6 +118,9 @@ var createControlsHoverDecoration = exports.createControlsHoverDecoration = func
|
|
|
115
118
|
if (selected) {
|
|
116
119
|
classes.push(_types.TableCssClassName.SELECTED_CELL);
|
|
117
120
|
}
|
|
121
|
+
if (isDragAndDropEnable && disabled) {
|
|
122
|
+
classes.push(_types.TableCssClassName.HOVERED_DISABLED_CELL);
|
|
123
|
+
}
|
|
118
124
|
classes.push(type === 'column' ? _types.TableCssClassName.HOVERED_COLUMN : type === 'row' ? _types.TableCssClassName.HOVERED_ROW : _types.TableCssClassName.HOVERED_TABLE);
|
|
119
125
|
var key;
|
|
120
126
|
switch (type) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// #region Imports
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable, getCellsInColumn, getCellsInRow } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
4
|
+
import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
|
|
5
5
|
import { TableDecorations } from '../types';
|
|
6
6
|
import { createCellHoverDecoration, createColumnLineResize, createControlsHoverDecoration, getMergedCellsPositions, updatePluginStateDecorations } from '../utils';
|
|
7
7
|
const makeArray = n => Array.from(Array(n).keys());
|
|
@@ -29,10 +29,13 @@ export const hoverMergedCells = () => createCommand(state => {
|
|
|
29
29
|
}, tr => tr.setMeta('addToHistory', false));
|
|
30
30
|
export const hoverColumns = (hoveredColumns, isInDanger) => createCommand(state => {
|
|
31
31
|
const cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
|
|
32
|
+
const {
|
|
33
|
+
isDragAndDropEnabled
|
|
34
|
+
} = getPluginState(state);
|
|
32
35
|
if (!cells) {
|
|
33
36
|
return false;
|
|
34
37
|
}
|
|
35
|
-
const decorations = createControlsHoverDecoration(cells, 'column', state.tr, isInDanger);
|
|
38
|
+
const decorations = createControlsHoverDecoration(cells, 'column', state.tr, isDragAndDropEnabled, hoveredColumns, isInDanger);
|
|
36
39
|
return {
|
|
37
40
|
type: 'HOVER_COLUMNS',
|
|
38
41
|
data: {
|
|
@@ -47,7 +50,10 @@ export const hoverRows = (hoveredRows, isInDanger) => createCommand(state => {
|
|
|
47
50
|
if (!cells) {
|
|
48
51
|
return false;
|
|
49
52
|
}
|
|
50
|
-
const
|
|
53
|
+
const {
|
|
54
|
+
isDragAndDropEnabled
|
|
55
|
+
} = getPluginState(state);
|
|
56
|
+
const decorations = createControlsHoverDecoration(cells, 'row', state.tr, isDragAndDropEnabled, hoveredRows, isInDanger);
|
|
51
57
|
return {
|
|
52
58
|
type: 'HOVER_ROWS',
|
|
53
59
|
data: {
|
|
@@ -69,7 +75,10 @@ export const hoverTable = (isInDanger, isSelected) => createCommand(state => {
|
|
|
69
75
|
if (!cells) {
|
|
70
76
|
return false;
|
|
71
77
|
}
|
|
72
|
-
const
|
|
78
|
+
const {
|
|
79
|
+
isDragAndDropEnabled
|
|
80
|
+
} = getPluginState(state);
|
|
81
|
+
const decorations = createControlsHoverDecoration(cells, 'table', state.tr, isDragAndDropEnabled, [], isInDanger, isSelected);
|
|
73
82
|
return {
|
|
74
83
|
type: 'HOVER_TABLE',
|
|
75
84
|
data: {
|
|
@@ -71,18 +71,31 @@ export const moveSource = (sourceType, sourceIndex, targetIndex) => createComman
|
|
|
71
71
|
export const toggleDragMenu = (isDragMenuOpen, direction, index) => createCommand(state => {
|
|
72
72
|
let {
|
|
73
73
|
isDragMenuOpen: previousOpenState,
|
|
74
|
-
dragMenuDirection,
|
|
75
|
-
dragMenuIndex
|
|
74
|
+
dragMenuDirection: previousDragMenuDirection,
|
|
75
|
+
dragMenuIndex: previousDragMenuIndex
|
|
76
76
|
} = getPluginState(state);
|
|
77
|
-
if (previousOpenState === isDragMenuOpen) {
|
|
77
|
+
if (previousOpenState === isDragMenuOpen && previousDragMenuDirection === direction && previousDragMenuIndex === index) {
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
|
+
let updatedMenuOpenState;
|
|
81
|
+
if (isDragMenuOpen !== undefined) {
|
|
82
|
+
updatedMenuOpenState = isDragMenuOpen;
|
|
83
|
+
} else {
|
|
84
|
+
// menu open but menu direction changed, means user clicked on drag handle of different row/column
|
|
85
|
+
// menu open menu direction not changed, but index changed, means user clicked on drag handle of same row/column, different cells.
|
|
86
|
+
// 2 scenarios above , menu should remain open.
|
|
87
|
+
if (previousOpenState === true && previousDragMenuDirection !== direction || previousOpenState === true && previousDragMenuDirection === direction && previousDragMenuIndex !== index) {
|
|
88
|
+
updatedMenuOpenState = true;
|
|
89
|
+
} else {
|
|
90
|
+
updatedMenuOpenState = !previousOpenState;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
80
93
|
return {
|
|
81
94
|
type: DragAndDropActionType.TOGGLE_DRAG_MENU,
|
|
82
95
|
data: {
|
|
83
|
-
isDragMenuOpen:
|
|
84
|
-
direction: direction !== null && direction !== void 0 ? direction :
|
|
85
|
-
index: index !== null && index !== void 0 ? index :
|
|
96
|
+
isDragMenuOpen: updatedMenuOpenState,
|
|
97
|
+
direction: direction !== null && direction !== void 0 ? direction : previousDragMenuDirection,
|
|
98
|
+
index: index !== null && index !== void 0 ? index : previousDragMenuIndex
|
|
86
99
|
}
|
|
87
100
|
};
|
|
88
101
|
}, tr => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
4
|
import { getCellsInRow } from '@atlaskit/editor-tables/utils';
|
|
4
5
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
5
6
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
@@ -49,7 +50,11 @@ export const createPlugin = (dispatch, eventDispatcher) => {
|
|
|
49
50
|
};
|
|
50
51
|
if (newTargetCellPosition !== undefined) {
|
|
51
52
|
const cells = getCellsInRow(dragMenuIndex)(tr.selection);
|
|
52
|
-
|
|
53
|
+
// ED-20673 check if it is a cell selection,
|
|
54
|
+
// when true, a drag handle is clicked and isDragMenuOpen is true here
|
|
55
|
+
// should not close the drag menu.
|
|
56
|
+
const isCellSelection = tr.selection instanceof CellSelection;
|
|
57
|
+
if (cells && cells.length && cells[0].node !== tr.doc.nodeAt(newTargetCellPosition) && !isCellSelection) {
|
|
53
58
|
return tr.setMeta(pluginKey, action);
|
|
54
59
|
} // else NOP
|
|
55
60
|
} else {
|
|
@@ -90,6 +90,8 @@ export const TableCssClassName = {
|
|
|
90
90
|
DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
|
|
91
91
|
DRAG_CORNER_BUTTON: `${tablePrefixSelector}-drag-corner-button`,
|
|
92
92
|
DRAG_CORNER_BUTTON_INNER: `${tablePrefixSelector}-drag-corner-button-inner`,
|
|
93
|
+
/** disabled classes */
|
|
94
|
+
DRAG_HANDLE_DISABLED: `${tablePrefixSelector}-drag-handle-disabled`,
|
|
93
95
|
/** Other classes */
|
|
94
96
|
NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
|
|
95
97
|
NUMBERED_COLUMN_BUTTON: `${tablePrefixSelector}-numbered-column__button`,
|
|
@@ -98,6 +100,7 @@ export const TableCssClassName = {
|
|
|
98
100
|
HOVERED_ROW: `${tablePrefixSelector}-hovered-row`,
|
|
99
101
|
HOVERED_TABLE: `${tablePrefixSelector}-hovered-table`,
|
|
100
102
|
HOVERED_CELL: `${tablePrefixSelector}-hovered-cell`,
|
|
103
|
+
HOVERED_DISABLED_CELL: `${tablePrefixSelector}-hovered-disabled`,
|
|
101
104
|
HOVERED_CELL_IN_DANGER: 'danger',
|
|
102
105
|
HOVERED_CELL_ACTIVE: 'active',
|
|
103
106
|
HOVERED_CELL_WARNING: `${tablePrefixSelector}-hovered-cell__warning`,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
5
5
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
6
|
+
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
6
7
|
import { TableCssClassName as ClassName } from '../../types';
|
|
8
|
+
import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
7
9
|
import { DragPreview } from '../DragPreview';
|
|
8
|
-
import { DragHandleIcon } from '../icons';
|
|
10
|
+
import { DragHandleDisabledIcon, DragHandleIcon } from '../icons';
|
|
9
11
|
export const DragHandle = ({
|
|
10
12
|
tableLocalId,
|
|
11
13
|
direction = 'row',
|
|
@@ -16,15 +18,26 @@ export const DragHandle = ({
|
|
|
16
18
|
onMouseOver,
|
|
17
19
|
onMouseOut,
|
|
18
20
|
onMouseUp,
|
|
19
|
-
onClick
|
|
21
|
+
onClick,
|
|
22
|
+
editorView
|
|
20
23
|
}) => {
|
|
21
24
|
const dragHandleDivRef = useRef(null);
|
|
22
25
|
const [previewContainer, setPreviewContainer] = useState(null);
|
|
26
|
+
const {
|
|
27
|
+
isDragAndDropEnabled
|
|
28
|
+
} = getPluginState(editorView.state);
|
|
29
|
+
const {
|
|
30
|
+
selection
|
|
31
|
+
} = editorView.state;
|
|
32
|
+
const hasMergedCells = useMemo(() => direction === 'row' ? hasMergedCellsInRow(indexes[0])(selection) : hasMergedCellsInColumn(indexes[0])(selection), [indexes, direction, selection]);
|
|
23
33
|
useEffect(() => {
|
|
24
34
|
const dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
25
35
|
if (dragHandleDivRefCurrent) {
|
|
26
36
|
return draggable({
|
|
27
37
|
element: dragHandleDivRefCurrent,
|
|
38
|
+
canDrag: () => {
|
|
39
|
+
return !hasMergedCells;
|
|
40
|
+
},
|
|
28
41
|
getInitialData() {
|
|
29
42
|
return {
|
|
30
43
|
localId: tableLocalId,
|
|
@@ -63,9 +76,9 @@ export const DragHandle = ({
|
|
|
63
76
|
}
|
|
64
77
|
});
|
|
65
78
|
}
|
|
66
|
-
}, [tableLocalId, direction, indexes]);
|
|
79
|
+
}, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells]);
|
|
67
80
|
return /*#__PURE__*/React.createElement("button", {
|
|
68
|
-
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance),
|
|
81
|
+
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, isDragAndDropEnabled && hasMergedCells && ClassName.DRAG_HANDLE_DISABLED),
|
|
69
82
|
ref: dragHandleDivRef,
|
|
70
83
|
style: {
|
|
71
84
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)',
|
|
@@ -76,7 +89,7 @@ export const DragHandle = ({
|
|
|
76
89
|
onMouseOut: onMouseOut,
|
|
77
90
|
onMouseUp: onMouseUp,
|
|
78
91
|
onClick: onClick
|
|
79
|
-
}, /*#__PURE__*/React.createElement(DragHandleIcon, null), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
92
|
+
}, hasMergedCells ? /*#__PURE__*/React.createElement(DragHandleDisabledIcon, null) : /*#__PURE__*/React.createElement(DragHandleIcon, null), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
80
93
|
direction: direction,
|
|
81
94
|
width: previewWidth,
|
|
82
95
|
height: previewHeight
|
|
@@ -6,6 +6,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
6
6
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
8
8
|
import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
|
|
9
|
+
import { getPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
|
|
9
10
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
10
11
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
11
12
|
import { dragMenuDropdownWidth } from '../consts';
|
|
@@ -76,12 +77,37 @@ export const DragMenu = ({
|
|
|
76
77
|
menuItems,
|
|
77
78
|
menuCallback
|
|
78
79
|
} = convertToDropdownItems(dragMenuConfig);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* This function is to check if the menu should be closed or not.
|
|
83
|
+
* As when continously clicking on drag handle on different rows/columns,
|
|
84
|
+
* should open the menu corresponding to the position of the drag handle.
|
|
85
|
+
* @returns true when the menu should be closed, false otherwise
|
|
86
|
+
*/
|
|
87
|
+
const shouldCloseMenu = state => {
|
|
88
|
+
let {
|
|
89
|
+
isDragMenuOpen: previousOpenState,
|
|
90
|
+
dragMenuDirection: previousDragMenuDirection,
|
|
91
|
+
dragMenuIndex: previousDragMenuIndex
|
|
92
|
+
} = getPluginState(state);
|
|
93
|
+
|
|
94
|
+
// menu open but menu direction changed, means user clicked on drag handle of different row/column
|
|
95
|
+
// menu open menu direction not changed, but index changed, means user clicked on drag handle of same row/column, different cells.
|
|
96
|
+
// 2 scenarios above , menu should not be closed.
|
|
97
|
+
if (previousOpenState === true && previousDragMenuDirection !== direction || previousOpenState === true && previousDragMenuDirection === direction && previousDragMenuIndex !== index) {
|
|
98
|
+
return false;
|
|
99
|
+
} else {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
79
103
|
const closeMenu = () => {
|
|
80
104
|
const {
|
|
81
105
|
state,
|
|
82
106
|
dispatch
|
|
83
107
|
} = editorView;
|
|
84
|
-
|
|
108
|
+
if (shouldCloseMenu(state)) {
|
|
109
|
+
toggleDragMenu(false, direction, index)(state, dispatch);
|
|
110
|
+
}
|
|
85
111
|
};
|
|
86
112
|
const handleMenuItemActivated = ({
|
|
87
113
|
item
|
|
@@ -121,7 +121,8 @@ export const ColumnControls = ({
|
|
|
121
121
|
onClick: handleClick,
|
|
122
122
|
onMouseOver: handleMouseOver,
|
|
123
123
|
onMouseOut: handleMouseOut,
|
|
124
|
-
onMouseUp: handleMouseUp
|
|
124
|
+
onMouseUp: handleMouseUp,
|
|
125
|
+
editorView: editorView
|
|
125
126
|
}))));
|
|
126
127
|
};
|
|
127
128
|
export default ColumnControls;
|
|
@@ -110,7 +110,8 @@ const DragControlsComponent = ({
|
|
|
110
110
|
onClick: handleClick,
|
|
111
111
|
onMouseOver: handleMouseOver,
|
|
112
112
|
onMouseOut: handleMouseOut,
|
|
113
|
-
onMouseUp: onMouseUp
|
|
113
|
+
onMouseUp: onMouseUp,
|
|
114
|
+
editorView: editorView
|
|
114
115
|
})));
|
|
115
116
|
};
|
|
116
117
|
export const DragControls = injectIntl(DragControlsComponent);
|
|
@@ -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, dragCornerControlButton, dragInsertButtonWrapper, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
|
|
10
|
+
import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, disabledCell, dragCornerControlButton, dragInsertButtonWrapper, 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
|
/*
|
|
@@ -226,6 +226,7 @@ export const tableStyles = props => {
|
|
|
226
226
|
${columnControlsLineMarker()};
|
|
227
227
|
${hoveredDeleteButton(props)};
|
|
228
228
|
${hoveredCell(props)};
|
|
229
|
+
${disabledCell(props)};
|
|
229
230
|
${hoveredWarningCell};
|
|
230
231
|
${getBooleanFF('platform.editor.table.drag-and-drop') && insertLine(props)};
|
|
231
232
|
${resizeHandle(props)};
|
|
@@ -673,55 +674,46 @@ export const tableStyles = props => {
|
|
|
673
674
|
align-items: center;
|
|
674
675
|
outline: none !important;
|
|
675
676
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
fill: ${"var(--ds-background-accent-gray-subtlest, #F1F2F4)"};
|
|
679
|
-
}
|
|
680
|
-
g {
|
|
681
|
-
fill: ${"var(--ds-icon-subtle, #626F86)"};
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
&:hover {
|
|
686
|
-
svg {
|
|
677
|
+
&:not(.${ClassName.DRAG_HANDLE_DISABLED}) {
|
|
678
|
+
& > svg {
|
|
687
679
|
rect {
|
|
688
|
-
fill: ${"var(--ds-background-accent-
|
|
680
|
+
fill: ${"var(--ds-background-accent-gray-subtlest, #F1F2F4)"};
|
|
689
681
|
}
|
|
690
682
|
g {
|
|
691
|
-
fill: ${"var(--ds-icon-
|
|
683
|
+
fill: ${"var(--ds-icon-subtle, #626F86)"};
|
|
692
684
|
}
|
|
693
685
|
}
|
|
694
|
-
}
|
|
695
686
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
687
|
+
&:hover {
|
|
688
|
+
svg {
|
|
689
|
+
rect {
|
|
690
|
+
fill: ${"var(--ds-background-accent-blue-subtle, #579DFF)"};
|
|
691
|
+
}
|
|
692
|
+
g {
|
|
693
|
+
fill: ${"var(--ds-icon-inverse, #FFF)"};
|
|
694
|
+
}
|
|
703
695
|
}
|
|
704
696
|
}
|
|
705
|
-
}
|
|
706
697
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
698
|
+
&.selected {
|
|
699
|
+
svg {
|
|
700
|
+
rect {
|
|
701
|
+
fill: ${"var(--ds-background-accent-blue-subtle, #579dff)"};
|
|
702
|
+
}
|
|
703
|
+
g {
|
|
704
|
+
fill: ${"var(--ds-icon-inverse, #fff)"};
|
|
705
|
+
}
|
|
714
706
|
}
|
|
715
707
|
}
|
|
716
|
-
}
|
|
717
708
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
709
|
+
&.danger {
|
|
710
|
+
svg {
|
|
711
|
+
rect {
|
|
712
|
+
fill: ${"var(--ds-background-accent-red-subtler-pressed, #F87462)"};
|
|
713
|
+
}
|
|
714
|
+
g {
|
|
715
|
+
fill: ${"var(--ds-border-inverse, #FFF)"};
|
|
716
|
+
}
|
|
725
717
|
}
|
|
726
718
|
}
|
|
727
719
|
}
|
|
@@ -56,6 +56,7 @@ export const tableCellDeleteColor = themed({
|
|
|
56
56
|
light: `var(--ds-blanket-danger, ${akEditorTableCellBlanketDeleted})`,
|
|
57
57
|
dark: `var(--ds-blanket-danger, ${akEditorTableCellBlanketDeleted})`
|
|
58
58
|
});
|
|
59
|
+
export const tableCellDisabledColor = "var(--ds-background-accent-gray-subtler-hovered, #C1C7D0)";
|
|
59
60
|
export const tableBorderDeleteColor = themed({
|
|
60
61
|
light: `var(--ds-border-danger, ${R400})`,
|
|
61
62
|
dark: `var(--ds-border-danger, ${R400})`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const DragHandleDisabledIcon = ({
|
|
3
|
+
style
|
|
4
|
+
}) => /*#__PURE__*/React.createElement("svg", {
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "16",
|
|
7
|
+
viewBox: "0 0 24 16",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
style: style
|
|
11
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
12
|
+
width: "24",
|
|
13
|
+
height: "16",
|
|
14
|
+
rx: "4",
|
|
15
|
+
fill: "var(--ds-background-accent-gray-subtlest, Neutral200)"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("rect", {
|
|
17
|
+
x: "7",
|
|
18
|
+
y: "4",
|
|
19
|
+
width: "2",
|
|
20
|
+
height: "8",
|
|
21
|
+
rx: "1",
|
|
22
|
+
fill: "var(--ds-icon-disabled, #091E424F)"
|
|
23
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
24
|
+
x: "11",
|
|
25
|
+
y: "4",
|
|
26
|
+
width: "2",
|
|
27
|
+
height: "8",
|
|
28
|
+
rx: "1",
|
|
29
|
+
fill: "var(--ds-icon-disabled, #091E424F)"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
31
|
+
x: "15",
|
|
32
|
+
y: "4",
|
|
33
|
+
width: "2",
|
|
34
|
+
height: "8",
|
|
35
|
+
rx: "1",
|
|
36
|
+
fill: "var(--ds-icon-disabled, #091E424F)"
|
|
37
|
+
})));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
|
+
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
3
4
|
export { AddRowAboveIcon } from './AddRowAboveIcon';
|
|
4
5
|
export { AddRowBelowIcon } from './AddRowBelowIcon';
|
|
5
6
|
export { AddColLeftIcon } from './AddColLeftIcon';
|
|
@@ -5,7 +5,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
5
5
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
7
7
|
import { TableCssClassName as ClassName } from '../types';
|
|
8
|
-
import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, insertLineWidth, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
8
|
+
import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, insertLineWidth, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellDisabledColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
9
9
|
const InsertLine = (props, cssString) => css`
|
|
10
10
|
.${ClassName.CONTROLS_INSERT_LINE} {
|
|
11
11
|
background: ${tableBorderSelectedColor(props)};
|
|
@@ -597,6 +597,18 @@ export const hoveredDeleteButton = props => css`
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
`;
|
|
600
|
+
export const disabledCell = props => css`
|
|
601
|
+
:not(.${ClassName.IS_RESIZING})
|
|
602
|
+
.${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
|
|
603
|
+
.${ClassName.HOVERED_CELL}.${ClassName.HOVERED_DISABLED_CELL} {
|
|
604
|
+
position: relative;
|
|
605
|
+
border: 1px solid ${tableCellDisabledColor};
|
|
606
|
+
}
|
|
607
|
+
.${ClassName.HOVERED_CELL}.${ClassName.HOVERED_DISABLED_CELL}::after {
|
|
608
|
+
border: 1px solid ${tableCellDisabledColor};
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
`;
|
|
600
612
|
export const hoveredCell = props => css`
|
|
601
613
|
:not(.${ClassName.IS_RESIZING})
|
|
602
614
|
.${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
|
|
@@ -11,6 +11,7 @@ import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tab
|
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
13
13
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
14
|
+
import { hasMergedCellsInColumn, hasMergedCellsInRow } from './merged-cells';
|
|
14
15
|
const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
|
|
15
16
|
export const findColumnControlSelectedDecoration = decorationSet => filterDecorationByKey(TableDecorations.COLUMN_SELECTED, decorationSet);
|
|
16
17
|
export const findControlsHoverDecoration = decorationSet => filterDecorationByKey(TableDecorations.ALL_CONTROLS_HOVER, decorationSet);
|
|
@@ -19,7 +20,7 @@ export const createCellHoverDecoration = cells => cells.map(cell => Decoration.n
|
|
|
19
20
|
}, {
|
|
20
21
|
key: TableDecorations.CELL_CONTROLS_HOVER
|
|
21
22
|
}));
|
|
22
|
-
export const createControlsHoverDecoration = (cells, type, tr, danger, selected) => {
|
|
23
|
+
export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) => {
|
|
23
24
|
const table = findTable(tr.selection);
|
|
24
25
|
if (!table) {
|
|
25
26
|
return [];
|
|
@@ -38,6 +39,8 @@ export const createControlsHoverDecoration = (cells, type, tr, danger, selected)
|
|
|
38
39
|
return [];
|
|
39
40
|
}
|
|
40
41
|
let updatedCells = cells.map(x => x.pos);
|
|
42
|
+
const hasMergedCells = type === 'row' ? hasMergedCellsInRow(hoveredIndexes[0])(tr.selection) : hasMergedCellsInColumn(hoveredIndexes[0])(tr.selection);
|
|
43
|
+
let disabled = hasMergedCells;
|
|
41
44
|
|
|
42
45
|
// ED-15246 fixed trello card table overflow issue
|
|
43
46
|
// If columns / rows have been merged the hovered selection is different to the actual selection
|
|
@@ -88,6 +91,9 @@ export const createControlsHoverDecoration = (cells, type, tr, danger, selected)
|
|
|
88
91
|
if (selected) {
|
|
89
92
|
classes.push(ClassName.SELECTED_CELL);
|
|
90
93
|
}
|
|
94
|
+
if (isDragAndDropEnable && disabled) {
|
|
95
|
+
classes.push(ClassName.HOVERED_DISABLED_CELL);
|
|
96
|
+
}
|
|
91
97
|
classes.push(type === 'column' ? ClassName.HOVERED_COLUMN : type === 'row' ? ClassName.HOVERED_ROW : ClassName.HOVERED_TABLE);
|
|
92
98
|
let key;
|
|
93
99
|
switch (type) {
|