@atlaskit/editor-plugin-table 5.3.26 → 5.3.28
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 +13 -0
- package/dist/cjs/plugins/table/commands/hover.js +9 -3
- package/dist/cjs/plugins/table/event-handlers.js +17 -13
- 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/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/event-handlers.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/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/event-handlers.js +5 -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/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/event-handlers.ts +4 -1
- package/src/plugins/table/types.ts +4 -0
- package/src/plugins/table/ui/DragHandle/index.tsx +36 -5
- 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
|
@@ -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: {
|
|
@@ -5,6 +5,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
5
5
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
|
|
8
|
+
import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-drop/plugin-factory';
|
|
8
9
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
9
10
|
import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
|
|
10
11
|
import { deleteColumns, deleteRows } from './transforms';
|
|
@@ -180,7 +181,11 @@ export const handleMouseLeave = (view, event) => {
|
|
|
180
181
|
return true;
|
|
181
182
|
}
|
|
182
183
|
if (isDragAndDropEnabled) {
|
|
183
|
-
|
|
184
|
+
const {
|
|
185
|
+
isDragMenuOpen
|
|
186
|
+
} = getDragDropPluginState(state);
|
|
187
|
+
// Only set hoveredCell colIndex and rowIndex to undefined if the drag menu is not open
|
|
188
|
+
!isDragMenuOpen && hoverCell()(state, dispatch);
|
|
184
189
|
}
|
|
185
190
|
if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && hideInsertColumnOrRowButton()(state, dispatch)) {
|
|
186
191
|
return true;
|
|
@@ -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
|
|
@@ -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) {
|
|
@@ -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
|
var makeArray = function makeArray(n) {
|
|
@@ -38,10 +38,12 @@ export var hoverMergedCells = function hoverMergedCells() {
|
|
|
38
38
|
export var hoverColumns = function hoverColumns(hoveredColumns, isInDanger) {
|
|
39
39
|
return createCommand(function (state) {
|
|
40
40
|
var cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
|
|
41
|
+
var _getPluginState = getPluginState(state),
|
|
42
|
+
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
41
43
|
if (!cells) {
|
|
42
44
|
return false;
|
|
43
45
|
}
|
|
44
|
-
var decorations = createControlsHoverDecoration(cells, 'column', state.tr, isInDanger);
|
|
46
|
+
var decorations = createControlsHoverDecoration(cells, 'column', state.tr, isDragAndDropEnabled, hoveredColumns, isInDanger);
|
|
45
47
|
return {
|
|
46
48
|
type: 'HOVER_COLUMNS',
|
|
47
49
|
data: {
|
|
@@ -60,7 +62,9 @@ export var hoverRows = function hoverRows(hoveredRows, isInDanger) {
|
|
|
60
62
|
if (!cells) {
|
|
61
63
|
return false;
|
|
62
64
|
}
|
|
63
|
-
var
|
|
65
|
+
var _getPluginState2 = getPluginState(state),
|
|
66
|
+
isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
|
|
67
|
+
var decorations = createControlsHoverDecoration(cells, 'row', state.tr, isDragAndDropEnabled, hoveredRows, isInDanger);
|
|
64
68
|
return {
|
|
65
69
|
type: 'HOVER_ROWS',
|
|
66
70
|
data: {
|
|
@@ -86,7 +90,9 @@ export var hoverTable = function hoverTable(isInDanger, isSelected) {
|
|
|
86
90
|
if (!cells) {
|
|
87
91
|
return false;
|
|
88
92
|
}
|
|
89
|
-
var
|
|
93
|
+
var _getPluginState3 = getPluginState(state),
|
|
94
|
+
isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
|
|
95
|
+
var decorations = createControlsHoverDecoration(cells, 'table', state.tr, isDragAndDropEnabled, [], isInDanger, isSelected);
|
|
90
96
|
return {
|
|
91
97
|
type: 'HOVER_TABLE',
|
|
92
98
|
data: {
|
|
@@ -6,6 +6,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
|
|
9
|
+
import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-drop/plugin-factory';
|
|
9
10
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
10
11
|
import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
|
|
11
12
|
import { deleteColumns, deleteRows } from './transforms';
|
|
@@ -174,7 +175,10 @@ export var handleMouseLeave = function handleMouseLeave(view, event) {
|
|
|
174
175
|
return true;
|
|
175
176
|
}
|
|
176
177
|
if (isDragAndDropEnabled) {
|
|
177
|
-
|
|
178
|
+
var _getDragDropPluginSta = getDragDropPluginState(state),
|
|
179
|
+
isDragMenuOpen = _getDragDropPluginSta.isDragMenuOpen;
|
|
180
|
+
// Only set hoveredCell colIndex and rowIndex to undefined if the drag menu is not open
|
|
181
|
+
!isDragMenuOpen && hoverCell()(state, dispatch);
|
|
178
182
|
}
|
|
179
183
|
if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && hideInsertColumnOrRowButton()(state, dispatch)) {
|
|
180
184
|
return true;
|
|
@@ -92,6 +92,8 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
92
92
|
DRAG_HANDLE_BUTTON_CONTAINER: "".concat(tablePrefixSelector, "-drag-handle-button-container"),
|
|
93
93
|
DRAG_CORNER_BUTTON: "".concat(tablePrefixSelector, "-drag-corner-button"),
|
|
94
94
|
DRAG_CORNER_BUTTON_INNER: "".concat(tablePrefixSelector, "-drag-corner-button-inner"),
|
|
95
|
+
/** disabled classes */
|
|
96
|
+
DRAG_HANDLE_DISABLED: "".concat(tablePrefixSelector, "-drag-handle-disabled"),
|
|
95
97
|
/** Other classes */
|
|
96
98
|
NUMBERED_COLUMN: "".concat(tablePrefixSelector, "-numbered-column"),
|
|
97
99
|
NUMBERED_COLUMN_BUTTON: "".concat(tablePrefixSelector, "-numbered-column__button"),
|
|
@@ -100,6 +102,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
100
102
|
HOVERED_ROW: "".concat(tablePrefixSelector, "-hovered-row"),
|
|
101
103
|
HOVERED_TABLE: "".concat(tablePrefixSelector, "-hovered-table"),
|
|
102
104
|
HOVERED_CELL: "".concat(tablePrefixSelector, "-hovered-cell"),
|
|
105
|
+
HOVERED_DISABLED_CELL: "".concat(tablePrefixSelector, "-hovered-disabled"),
|
|
103
106
|
HOVERED_CELL_IN_DANGER: 'danger',
|
|
104
107
|
HOVERED_CELL_ACTIVE: 'active',
|
|
105
108
|
HOVERED_CELL_WARNING: "".concat(tablePrefixSelector, "-hovered-cell__warning"),
|