@atlaskit/editor-plugin-table 5.3.5 → 5.3.7
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 +12 -0
- package/dist/cjs/plugins/table/types.js +1 -0
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +66 -8
- package/dist/cjs/plugins/table/ui/DragPreview/index.js +1 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +8 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +1 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/icons/DragHandleIcon.js +63 -0
- package/dist/es2019/plugins/table/types.js +1 -0
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +62 -9
- package/dist/es2019/plugins/table/ui/DragPreview/index.js +1 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +8 -4
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +9 -0
- package/dist/es2019/plugins/table/ui/icons/DragHandleIcon.js +54 -0
- package/dist/esm/plugins/table/types.js +1 -0
- package/dist/esm/plugins/table/ui/DragHandle/index.js +66 -9
- package/dist/esm/plugins/table/ui/DragPreview/index.js +1 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +8 -4
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +1 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/icons/DragHandleIcon.js +55 -0
- package/dist/types/plugins/table/types.d.ts +1 -0
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +5 -1
- package/dist/types/plugins/table/ui/icons/DragHandleIcon.d.ts +7 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +5 -1
- package/dist/types-ts4.5/plugins/table/ui/icons/DragHandleIcon.d.ts +7 -0
- package/package.json +2 -3
- package/src/plugins/table/types.ts +1 -1
- package/src/plugins/table/ui/DragHandle/index.tsx +70 -9
- package/src/plugins/table/ui/DragPreview/index.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +9 -3
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +1 -1
- package/src/plugins/table/ui/common-styles.ts +9 -0
- package/src/plugins/table/ui/icons/DragHandleIcon.tsx +74 -0
- package/tsconfig.app.json +0 -3
- /package/dist/cjs/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
- /package/dist/es2019/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
- /package/dist/esm/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
- /package/dist/types/plugins/table/ui/{Icons → icons}/DragInMotionIcon.d.ts +0 -0
- /package/dist/types-ts4.5/plugins/table/ui/{Icons → icons}/DragInMotionIcon.d.ts +0 -0
- /package/src/plugins/table/ui/{Icons → icons}/DragInMotionIcon.tsx +0 -0
|
@@ -82,6 +82,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
82
82
|
/** Controls with drag handle */
|
|
83
83
|
COLUMN_CONTROLS_DECORATIONS_WITH_DRAG: "".concat(tablePrefixSelector, "-column-controls-decoration-with-drag"),
|
|
84
84
|
ROW_CONTROLS_WITH_DRAG: "".concat(tablePrefixSelector, "-row-controls-with-drag"),
|
|
85
|
+
DRAG_HANDLE_BUTTON_CONTAINER: "".concat(tablePrefixSelector, "-drag-handle-button-container"),
|
|
85
86
|
/** Other classes */
|
|
86
87
|
NUMBERED_COLUMN: "".concat(tablePrefixSelector, "-numbered-column"),
|
|
87
88
|
NUMBERED_COLUMN_BUTTON: "".concat(tablePrefixSelector, "-numbered-column__button"),
|
|
@@ -1,17 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
3
4
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
6
|
+
import { N200, N700 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { TableCssClassName as ClassName } from '../../types';
|
|
8
|
+
import { DragPreview } from '../DragPreview';
|
|
9
|
+
import { DragHandleIcon } from '../icons/DragHandleIcon';
|
|
10
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
11
|
+
switch (state) {
|
|
12
|
+
case 'danger':
|
|
13
|
+
case 'disabled':
|
|
14
|
+
case 'selected':
|
|
15
|
+
case 'default':
|
|
16
|
+
default:
|
|
17
|
+
return {
|
|
18
|
+
backgroundColor: "var(--ds-background-accent-gray-subtlest, ".concat(N200, ")"),
|
|
19
|
+
foregroundColor: "var(--ds-icon-subtle, ".concat(N700, ")")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
6
23
|
export var DragHandle = function DragHandle(_ref) {
|
|
7
24
|
var tableLocalId = _ref.tableLocalId,
|
|
8
25
|
_ref$direction = _ref.direction,
|
|
9
26
|
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
|
|
27
|
+
_ref$state = _ref.state,
|
|
28
|
+
state = _ref$state === void 0 ? 'default' : _ref$state,
|
|
10
29
|
indexes = _ref.indexes,
|
|
30
|
+
previewWidth = _ref.previewWidth,
|
|
31
|
+
previewHeight = _ref.previewHeight,
|
|
11
32
|
onClick = _ref.onClick,
|
|
12
33
|
onMouseOver = _ref.onMouseOver,
|
|
13
34
|
onMouseOut = _ref.onMouseOut;
|
|
14
35
|
var dragHandleDivRef = useRef(null);
|
|
36
|
+
var iconProps = mapStateToProps(state);
|
|
37
|
+
var _useState = useState(null),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
previewContainer = _useState2[0],
|
|
40
|
+
setPreviewContainer = _useState2[1];
|
|
15
41
|
useEffect(function () {
|
|
16
42
|
var dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
17
43
|
if (dragHandleDivRefCurrent) {
|
|
@@ -23,19 +49,50 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
23
49
|
type: "table-".concat(direction),
|
|
24
50
|
indexes: indexes
|
|
25
51
|
};
|
|
52
|
+
},
|
|
53
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref2) {
|
|
54
|
+
var nativeSetDragImage = _ref2.nativeSetDragImage;
|
|
55
|
+
setCustomNativeDragPreview({
|
|
56
|
+
getOffset: function getOffset(_ref3) {
|
|
57
|
+
var container = _ref3.container;
|
|
58
|
+
var rect = container.getBoundingClientRect();
|
|
59
|
+
if (direction === 'row') {
|
|
60
|
+
return {
|
|
61
|
+
x: 16,
|
|
62
|
+
y: 16
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
return {
|
|
66
|
+
x: rect.width / 2 + 16,
|
|
67
|
+
y: 16
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
render: function render(_ref4) {
|
|
72
|
+
var container = _ref4.container;
|
|
73
|
+
setPreviewContainer(container);
|
|
74
|
+
return function () {
|
|
75
|
+
return setPreviewContainer(null);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
nativeSetDragImage: nativeSetDragImage
|
|
79
|
+
});
|
|
26
80
|
}
|
|
27
81
|
});
|
|
28
82
|
}
|
|
29
83
|
}, [tableLocalId, direction, indexes]);
|
|
30
|
-
return /*#__PURE__*/React.createElement("
|
|
84
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
85
|
+
className: ClassName.DRAG_HANDLE_BUTTON_CONTAINER,
|
|
31
86
|
ref: dragHandleDivRef,
|
|
32
87
|
style: {
|
|
33
88
|
backgroundColor: "var(--ds-surface, white)",
|
|
34
89
|
borderRadius: '4px',
|
|
35
90
|
border: "2px solid ".concat("var(--ds-surface, white)"),
|
|
36
|
-
transform: direction === 'column' ? '
|
|
91
|
+
transform: direction === 'column' ? 'none' : 'rotate(90deg)'
|
|
37
92
|
}
|
|
38
|
-
}, /*#__PURE__*/React.createElement(
|
|
39
|
-
|
|
40
|
-
|
|
93
|
+
}, /*#__PURE__*/React.createElement(DragHandleIcon, iconProps), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
94
|
+
direction: direction,
|
|
95
|
+
width: previewWidth,
|
|
96
|
+
height: previewHeight
|
|
97
|
+
}), previewContainer));
|
|
41
98
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
3
|
-
import { DragInMotionIcon } from '../
|
|
3
|
+
import { DragInMotionIcon } from '../icons/DragInMotionIcon';
|
|
4
4
|
var boxStyles = xcss({
|
|
5
5
|
borderColor: 'color.border.focused',
|
|
6
6
|
borderStyle: 'solid',
|
|
@@ -12,9 +12,10 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
12
12
|
tableActive = _ref.tableActive,
|
|
13
13
|
editorView = _ref.editorView;
|
|
14
14
|
var rowHeights = getRowHeights(tableRef);
|
|
15
|
-
var heights = rowHeights.map(function (height) {
|
|
15
|
+
var heights = rowHeights.map(function (height, index) {
|
|
16
16
|
return "".concat(height - 1, "px");
|
|
17
17
|
}).join(' ');
|
|
18
|
+
var rowWidth = tableRef.offsetWidth;
|
|
18
19
|
var _onClick = function onClick(index, event) {};
|
|
19
20
|
var onMouseOver = function onMouseOver() {};
|
|
20
21
|
var onMouseOut = function onMouseOut() {};
|
|
@@ -29,9 +30,10 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
29
30
|
style: {
|
|
30
31
|
gridTemplateRows: heights
|
|
31
32
|
}
|
|
32
|
-
}, Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
}, rowIndex !== undefined && Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
|
|
33
34
|
style: {
|
|
34
|
-
gridRow: "".concat(rowIndex + 1, " / span 1")
|
|
35
|
+
gridRow: "".concat(rowIndex + 1, " / span 1"),
|
|
36
|
+
display: 'flex'
|
|
35
37
|
}
|
|
36
38
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
37
39
|
onClick: function onClick(event) {
|
|
@@ -40,7 +42,9 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
40
42
|
onMouseOver: onMouseOver,
|
|
41
43
|
onMouseOut: onMouseOut,
|
|
42
44
|
tableLocalId: getLocalId(),
|
|
43
|
-
indexes: []
|
|
45
|
+
indexes: [rowIndex],
|
|
46
|
+
previewWidth: rowWidth,
|
|
47
|
+
previewHeight: rowHeights[rowIndex]
|
|
44
48
|
})));
|
|
45
49
|
};
|
|
46
50
|
export var DragControls = injectIntl(DragControlsComponent);
|
|
@@ -137,7 +137,7 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
137
137
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
138
138
|
return /*#__PURE__*/React.createElement("div", {
|
|
139
139
|
onMouseDown: function onMouseDown(e) {
|
|
140
|
-
return e.preventDefault();
|
|
140
|
+
return !isDragAndDropEnabled && e.preventDefault();
|
|
141
141
|
}
|
|
142
142
|
}, isNumberColumnEnabled ? /*#__PURE__*/React.createElement(NumberColumn, {
|
|
143
143
|
editorView: editorView,
|
|
@@ -61,7 +61,7 @@ var tableWrapperStyles = function tableWrapperStyles() {
|
|
|
61
61
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4139
|
|
62
62
|
export var tableStyles = function tableStyles(props) {
|
|
63
63
|
var _props$featureFlags;
|
|
64
|
-
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n ", "\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection but below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: 0 6px 4px -4px ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n /* needs to be above sticky header row and below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky\n .", ",\n tr.sticky\n .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", " {\n padding: 0 ", "px;\n\n // https://product-fabric.atlassian.net/browse/ED-16386\n // Fixes issue where the extra padding that is added here throws off the position\n // of the rows control dot\n &::after {\n right: 6px !important;\n }\n }\n\n .", " {\n padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n .", ", .", " {\n width: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level unless wrapped in fragment mark */\n ", "\n\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n .", " {\n display: grid;\n align-items: center;\n position: absolute;\n }\n\n ", "\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n // add a background above the first numbered column cell when sticky header is engaged\n // which hides the table when scrolling\n .", ":first-of-type::after {\n content: '';\n display: block;\n height: 33px;\n width: 100%;\n background-color: ", ";\n position: absolute;\n\n // the extra pixel is accounting for borders\n top: -34px;\n left: -1px;\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: ", "px;\n\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", ":not(.", ") {\n cursor: pointer;\n }\n .", ":not(.", "):hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n // Allows better positioning for the shadow sentinels - ED-16668\n position: relative;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n /* ED-19064: To fix when enable header column in the table,\n and selection the header column, the right border is not tableBorderSelectedColor\n when deleting the header column, the right border is not tableToolbarDeleteColor */\n td.", ",\n td.", ",\n th.", ".", ",\n th.", ".", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n ", ";\n z-index: ", ";\n }\n }\n }\n ", "\n .", ".", " {\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n top: ", "px;\n }\n\n ", "\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n /*\n ED-15882: When custom start numbers is enabled for lists, we have\n styles that handle this generally (in editor-common) so we can\n throw away the older table-specific styles here.\n */\n ", "\n\n ", "\n"])), ClassName.LAYOUT_BUTTON, "var(--ds-background-neutral, ".concat(N20A, ")"), "var(--ds-icon, ".concat(N300, ")"), ClassName.LAYOUT_BUTTON, ClassName.IS_RESIZING, "var(--ds-background-neutral-hovered, ".concat(B300, ")"), "var(--ds-icon, white)", tableSharedStyle(props), columnControlsLineMarker(), hoveredDeleteButton(props), hoveredCell(props), hoveredWarningCell, getBooleanFF('platform.editor.table.drag-and-drop') && insertLine(props), resizeHandle(props), rangeSelectionStyles, ClassName.LAST_ITEM_IN_CELL, ClassName.TABLE_NODE_WRAPPER, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.TABLE_CELL, tableCellBackgroundColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.CONTROLS_FLOATING_BUTTON_COLUMN, insertColumnButtonWrapper(props), ClassName.CONTROLS_FLOATING_BUTTON_ROW, insertRowButtonWrapper(props), DeleteButton(props), ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, stickyRowOffsetTop + 2, akEditorTableNumberColumnWidth, akEditorStickyHeaderZIndex, stickyRowOffsetTop, "var(--ds-surface, white)", ClassName.TABLE_STICKY, ClassName.CORNER_CONTROLS, akEditorSmallZIndex, "var(--ds-surface, white)", tableToolbarSize, tableToolbarSize, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize, tableToolbarSize, tableStickyHeaderColumnControlsDecorationsStyle(props), ClassName.TABLE_STICKY, ClassName.ROW_CONTROLS, ClassName.ROW_CONTROLS_BUTTON_WRAP, akEditorStickyHeaderZIndex, tableToolbarSize, "var(--ds-surface, white)", tableToolbarSize, ClassName.TABLE_STICKY, "var(--ds-surface, green)", stickyRowOffsetTop, akEditorTableCellOnStickyHeaderZIndex - 5, "var(--ds-surface, white)", "var(--ds-shadow-overflow-perimeter, ".concat(N40A, ")"), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, akEditorTableCellOnStickyHeaderZIndex, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tableToolbarSize, stickyHeaderBorderBottomWidth, tableBorderColor(props), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, insertColumnButtonOffset + 1, ClassName.TABLE_STICKY, ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY, ClassName.WITH_RESIZE_LINE, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2 + 1, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.WITH_CONTROLS, tableControlsSpacing, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, tableControlsSpacing + 2, ClassName.CORNER_CONTROLS, tableControlsSpacing - tableToolbarSize + 2, "var(--ds-surface, white)", sentinelStyles, OverflowShadow(props), stickyScrollbarStyles(), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tablePadding, ClassName.ROW_CONTROLS_WRAPPER, tablePadding, ClassName.COLUMN_CONTROLS_WRAPPER, tablePadding, ClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth + tablePadding - 1, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, tableOverflowShadowWidth, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, ClassName.NODEVIEW_WRAPPER, breakoutWidthStyling(), columnControlsDecoration(props), ClassName.CORNER_CONTROLS, tableToolbarSize + 1, cornerControlHeight, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, InsertMarker(props, "\n left: -11px;\n top: 9px;\n "), ClassName.CORNER_CONTROLS, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize + 1, tableToolbarSize + 1, tableBorderColor(props), tableBorderRadiusSize, tableHeaderCellBackgroundColor(props), ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor(props), tableToolbarSelectedColor(props), ClassName.TABLE_CONTAINER, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1 : akEditorTableToolbarSize + akEditorTableNumberColumnWidth, ClassName.ROW_CONTROLS, ClassName.CONTROLS_BUTTON, ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor(props), tableToolbarSelectedColor(props), ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableBorderDeleteColor(props), tableToolbarDeleteColor(props), ClassName.ROW_CONTROLS, tableToolbarSize, InsertMarker(props, "\n bottom: -1px;\n left: -11px;\n "), ClassName.ROW_CONTROLS_INNER, ClassName.ROW_CONTROLS_BUTTON_WRAP, tableBorderRadiusSize, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.CONTROLS_BUTTON, akEditorUnitZIndex, HeaderButton(props, "\n border-bottom: 1px solid ".concat(tableBorderColor(props), ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(tableToolbarSize, "px;\n\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), ClassName.ROW_CONTROLS_WITH_DRAG, floatingColumnControls(props), ClassName.IS_RESIZING, ClassName.ROW_CONTROLS, HeaderButtonHover(props), HeaderButtonDanger(props), ClassName.NUMBERED_COLUMN, getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize : akEditorTableToolbarSize - 1, getBooleanFF('platform.editor.table.drag-and-drop') ? 0 : akEditorTableToolbarSize, akEditorTableNumberColumnWidth + 1, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderColor(props), relativeFontSizeToBase16(fontSize()), tableHeaderCellBackgroundColor(props), tableTextColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, "var(--ds-surface, white)", ClassName.WITH_CONTROLS, ClassName.CORNER_CONTROLS, ClassName.ROW_CONTROLS, ClassName.NUMBERED_COLUMN, getBooleanFF('platform.editor.custom-table-width') ? 0 : 1, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor(props), tableBorderSelectedColor(props), tableToolbarSelectedColor(props), akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.IS_RESIZING, ClassName.WITH_CONTROLS, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, tableBorderSelectedColor(props), tableBorderSelectedColor(props), tableToolbarSelectedColor(props), akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.NUMBERED_COLUMN_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), "var(--ds-text-danger, ".concat(R500, ")"), akEditorUnitZIndex, ClassName.TABLE_NODE_WRAPPER, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, akEditorSmallZIndex, ClassName.SELECTED_CELL, tableBorderSelectedColor(props), ClassName.SELECTED_CELL, tableCellSelectedColor(props), akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, ClassName.HOVERED_CELL_IN_DANGER, tableCellDeleteColor(props), akEditorUnitZIndex * 100, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.HOVERED_CELL, tableBorderSelectedColor(props), akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, tableBorderStyles(props), akEditorUnitZIndex * 100, tableRowControlStyles(), ClassName.ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, akEditorUnitZIndex, ClassName.COLUMN_CONTROLS_WRAPPER, tableMarginTop + 1, tableWrapperStyles(), ClassName.IS_RESIZING, ClassName.TABLE_NODE_WRAPPER, scrollbarStyles, ClassName.RESIZE_CURSOR, props !== null && props !== void 0 && (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.restartNumberedLists ? "" : listLargeNumericMarkersOldStyles, shadowSentinelStyles);
|
|
64
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n .", " button {\n background: ", ";\n color: ", ";\n cursor: none;\n }\n\n .", ":not(.", ") button:hover {\n background: ", ";\n color: ", " !important;\n cursor: pointer;\n }\n\n .ProseMirror {\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n .", " {\n margin-bottom: 0;\n }\n\n .", " {\n td.", ", th.", " {\n position: relative;\n overflow: visible;\n }\n\n td.", " {\n background-color: ", ";\n\n // ED-15246: Trello card is visible through a border of a table border\n // This fixes a border issue caused by relative positioned table cells\n &::after {\n height: 100%;\n content: '';\n border-left: 1px solid ", ";\n border-bottom: 1px solid ", ";\n position: absolute;\n right: 0px;\n top: 0px;\n bottom: 0;\n width: 100%;\n display: inline-block;\n pointer-events: none;\n }\n }\n }\n\n .", " {\n ", "\n }\n\n .", " {\n ", "\n }\n\n /* Delete button */\n ", "\n /* Ends Delete button */\n\n /* sticky styles */\n .", " .", " .", ":first-of-type {\n margin-top: ", "px;\n width: ", "px;\n\n position: fixed !important;\n z-index: ", " !important;\n box-shadow: 0px -", "px ", ";\n border-right: 0 none;\n /* top set by NumberColumn component */\n }\n\n .", " .", ".sticky {\n position: fixed !important;\n /* needs to be above row controls */\n z-index: ", " !important;\n background: ", ";\n\n width: ", "px;\n height: ", "px;\n }\n\n .", ".sticky .", " {\n border-bottom: 0px none;\n border-right: 0px none;\n\n height: ", "px;\n width: ", "px;\n }\n\n ", "\n\n .", "\n .", "\n .", ".sticky {\n position: fixed !important;\n z-index: ", " !important;\n display: flex;\n border-left: ", "px solid\n ", ";\n margin-left: -", "px;\n }\n\n .", " col:first-of-type {\n /* moving rows out of a table layout does weird things in Chrome */\n border-right: 1px solid ", ";\n }\n\n tr.sticky {\n padding-top: ", "px;\n position: fixed;\n display: grid;\n\n /* to keep it above cell selection but below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n\n overflow-y: visible;\n overflow-x: hidden;\n\n grid-auto-flow: column;\n\n /* background for where controls apply */\n background: ", ";\n box-sizing: content-box;\n\n margin-top: 2px;\n\n box-shadow: 0 6px 4px -4px ", ";\n margin-left: -1px;\n\n &.no-pointer-events {\n pointer-events: none;\n }\n }\n\n .", " .", " {\n left: unset;\n position: fixed;\n /* needs to be above sticky header row and below date and other nodes popups that are inside sticky header */\n z-index: ", ";\n }\n\n .", ".", "\n .", " {\n padding-bottom: ", "px;\n }\n\n tr.sticky th {\n border-bottom: ", "px solid\n ", ";\n margin-right: -1px;\n }\n\n .", " tr.sticky > th:last-child {\n border-right-width: 1px;\n }\n\n /* add left edge for first cell */\n .", " tr.sticky > th:first-of-type {\n margin-left: 0px;\n }\n\n /* add a little bit so the scroll lines up with the table */\n .", " tr.sticky::after {\n content: ' ';\n width: ", "px;\n }\n\n /* To fix jumpiness caused in Chrome Browsers for sticky headers */\n .", " .sticky + tr {\n min-height: 0px;\n }\n\n /* move resize line a little in sticky bar */\n .", ".", " {\n tr.sticky\n td.", ",\n tr.sticky\n th.", " {\n .", "::after {\n right: ", "px;\n }\n }\n\n /* when selected put it back to normal -- :not selector would be nicer */\n tr.sticky\n td.", ".", ",\n tr.sticky\n th.", ".", " {\n .", "::after {\n right: ", "px;\n }\n }\n }\n\n tr.sticky\n .", ",\n tr.sticky\n .", " {\n z-index: 1;\n }\n\n .", " tr.sticky {\n padding-top: ", "px;\n }\n\n .", ".", "\n .", "\n .", ":first-of-type {\n margin-top: ", "px;\n }\n\n .", ".sticky {\n border-top: ", "px solid\n ", ";\n }\n\n ", "\n ", "\n ", "\n\n .", " .", " {\n height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts\n }\n\n .less-padding {\n padding: 0 ", "px;\n\n .", " {\n padding: 0 ", "px;\n\n // https://product-fabric.atlassian.net/browse/ED-16386\n // Fixes issue where the extra padding that is added here throws off the position\n // of the rows control dot\n &::after {\n right: 6px !important;\n }\n }\n\n .", " {\n padding: 0 ", "px;\n }\n\n &.", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n .", ", .", " {\n width: ", "px;\n }\n\n .", " {\n left: 6px;\n }\n\n .", " {\n left: calc(100% - 6px);\n }\n }\n\n > .", " {\n /**\n * Prevent margins collapsing, aids with placing the gap-cursor correctly\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n *\n * TODO: Enable this, many tests will fail!\n * border-top: 1px solid transparent;\n */\n }\n\n /* Breakout only works on top level unless wrapped in fragment mark */\n ", "\n\n ", ";\n\n /* Corner controls */\n .", " {\n width: ", "px;\n height: ", "px;\n display: none;\n\n .", " {\n position: relative;\n\n ", ";\n }\n }\n\n .", ".sticky {\n .", " {\n /* sticky row insert dot overlaps other row insert and messes things up */\n display: none !important;\n }\n }\n\n .", " {\n position: absolute;\n top: 0;\n width: ", "px;\n height: ", "px;\n border: 1px solid ", ";\n border-radius: 0;\n border-top-left-radius: ", "px;\n background: ", ";\n box-sizing: border-box;\n padding: 0;\n :focus {\n outline: none;\n }\n }\n .active .", " {\n border-color: ", ";\n background: ", ";\n }\n\n .", "[data-number-column='true'] {\n .", ", .", " {\n width: ", "px;\n }\n .", " .", " {\n border-right-width: 0;\n }\n }\n\n :not(.", ") .", ":hover {\n border-color: ", ";\n background: ", ";\n cursor: pointer;\n }\n\n :not(.", ")\n .", ".", " {\n border-color: ", ";\n background: ", ";\n }\n\n /* Row controls */\n .", " {\n width: ", "px;\n box-sizing: border-box;\n display: none;\n position: relative;\n\n ", ";\n\n .", " {\n display: flex;\n flex-direction: column;\n }\n .", ":last-child > button {\n border-bottom-left-radius: ", "px;\n }\n .", " {\n position: relative;\n margin-top: -1px;\n }\n .", ":hover,\n .", ".active,\n .", ":hover {\n z-index: ", ";\n }\n\n ", "\n }\n\n .", " {\n display: grid;\n align-items: center;\n position: absolute;\n left: -4px;\n }\n\n .", " {\n cursor: grab;\n width: max-content;\n padding: 0;\n border: none;\n background: none;\n }\n\n ", "\n\n :not(.", ") .", " {\n ", "\n ", "\n }\n\n /* Numbered column */\n .", " {\n position: relative;\n float: right;\n margin-left: ", "px;\n top: ", "px;\n width: ", "px;\n box-sizing: border-box;\n }\n\n .", " {\n border: 1px solid ", ";\n box-sizing: border-box;\n margin-top: -1px;\n padding-bottom: 2px;\n padding: 10px 2px;\n text-align: center;\n font-size: ", ";\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n :first-child:not(style),\n style:first-child + * {\n margin-top: 0;\n }\n :last-child {\n border-bottom: 1px solid ", ";\n }\n }\n\n // add a background above the first numbered column cell when sticky header is engaged\n // which hides the table when scrolling\n .", ":first-of-type::after {\n content: '';\n display: block;\n height: 33px;\n width: 100%;\n background-color: ", ";\n position: absolute;\n\n // the extra pixel is accounting for borders\n top: -34px;\n left: -1px;\n }\n\n .", " {\n .", ", .", " {\n display: block;\n }\n .", " {\n padding-left: ", "px;\n\n .", " {\n border-left: 0 none;\n }\n\n .", ".active {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n }\n }\n :not(.", ") .", " {\n .", ":not(.", ") {\n cursor: pointer;\n }\n .", ":not(.", "):hover {\n border-bottom: 1px solid ", ";\n border-color: ", ";\n background-color: ", ";\n position: relative;\n z-index: ", ";\n color: ", ";\n }\n .", ".", " {\n background-color: ", ";\n border: 1px solid ", ";\n border-left: 0;\n color: ", ";\n position: relative;\n z-index: ", ";\n }\n }\n\n /* Table */\n .", " > table {\n table-layout: fixed;\n white-space: normal;\n border-top: none;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n // Allows better positioning for the shadow sentinels - ED-16668\n position: relative;\n\n > tbody > tr {\n white-space: pre-wrap;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n .", " + * {\n margin-top: 0;\n }\n\n /*\n * Headings have a top margin by default, but we don't want this on the\n * first heading within table header cells.\n *\n * This specifically sets margin-top for the first heading within a header\n * cell when center/right aligned.\n */\n th.", " > .fabric-editor-block-mark {\n > h1:first-of-type,\n > h2:first-of-type,\n > h3:first-of-type,\n > h4:first-of-type,\n > h5:first-of-type,\n > h6:first-of-type {\n margin-top: 0;\n }\n }\n\n .", ", .", " {\n position: relative;\n }\n /* Give selected cells a blue overlay */\n .", "::after,\n .", "::after {\n z-index: ", ";\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n }\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n z-index: ", ";\n }\n th.", "::after,\n td.", "::after {\n background: ", ";\n z-index: ", ";\n }\n // ED-15246: Trello card is visible through a border of a table border\n /* ED-19064: To fix when enable header column in the table,\n and selection the header column, the right border is not tableBorderSelectedColor\n when deleting the header column, the right border is not tableToolbarDeleteColor */\n td.", ",\n td.", ",\n th.", ".", ",\n th.", ".", " {\n &::after {\n height: 100%;\n width: 100%;\n border: 1px solid ", ";\n content: '';\n position: absolute;\n left: -1px;\n top: -1px;\n bottom: 0;\n z-index: ", ";\n display: inline-block;\n pointer-events: none;\n }\n &.", "::after {\n ", ";\n z-index: ", ";\n }\n }\n }\n ", "\n .", ".", " {\n z-index: ", ";\n }\n\n .", " {\n position: absolute;\n top: ", "px;\n }\n\n ", "\n }\n\n .ProseMirror.", " {\n .", " {\n overflow-x: auto;\n ", ";\n }\n }\n\n .ProseMirror.", " {\n cursor: col-resize;\n }\n\n /*\n ED-15882: When custom start numbers is enabled for lists, we have\n styles that handle this generally (in editor-common) so we can\n throw away the older table-specific styles here.\n */\n ", "\n\n ", "\n"])), ClassName.LAYOUT_BUTTON, "var(--ds-background-neutral, ".concat(N20A, ")"), "var(--ds-icon, ".concat(N300, ")"), ClassName.LAYOUT_BUTTON, ClassName.IS_RESIZING, "var(--ds-background-neutral-hovered, ".concat(B300, ")"), "var(--ds-icon, white)", tableSharedStyle(props), columnControlsLineMarker(), hoveredDeleteButton(props), hoveredCell(props), hoveredWarningCell, getBooleanFF('platform.editor.table.drag-and-drop') && insertLine(props), resizeHandle(props), rangeSelectionStyles, ClassName.LAST_ITEM_IN_CELL, ClassName.TABLE_NODE_WRAPPER, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.TABLE_CELL, tableCellBackgroundColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.CONTROLS_FLOATING_BUTTON_COLUMN, insertColumnButtonWrapper(props), ClassName.CONTROLS_FLOATING_BUTTON_ROW, insertRowButtonWrapper(props), DeleteButton(props), ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, stickyRowOffsetTop + 2, akEditorTableNumberColumnWidth, akEditorStickyHeaderZIndex, stickyRowOffsetTop, "var(--ds-surface, white)", ClassName.TABLE_STICKY, ClassName.CORNER_CONTROLS, akEditorSmallZIndex, "var(--ds-surface, white)", tableToolbarSize, tableToolbarSize, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize, tableToolbarSize, tableStickyHeaderColumnControlsDecorationsStyle(props), ClassName.TABLE_STICKY, ClassName.ROW_CONTROLS, ClassName.ROW_CONTROLS_BUTTON_WRAP, akEditorStickyHeaderZIndex, tableToolbarSize, "var(--ds-surface, white)", tableToolbarSize, ClassName.TABLE_STICKY, "var(--ds-surface, green)", stickyRowOffsetTop, akEditorTableCellOnStickyHeaderZIndex - 5, "var(--ds-surface, white)", "var(--ds-shadow-overflow-perimeter, ".concat(N40A, ")"), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, akEditorTableCellOnStickyHeaderZIndex, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tableToolbarSize, stickyHeaderBorderBottomWidth, tableBorderColor(props), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, ClassName.TABLE_STICKY, insertColumnButtonOffset + 1, ClassName.TABLE_STICKY, ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY, ClassName.WITH_RESIZE_LINE, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2 + 1, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.WITH_RESIZE_LINE, ClassName.SELECTED_CELL, ClassName.RESIZE_HANDLE_DECORATION, (resizeHandlerAreaWidth - resizeLineWidth) / 2, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.WITH_CONTROLS, tableControlsSpacing, ClassName.WITH_CONTROLS, ClassName.TABLE_STICKY, ClassName.NUMBERED_COLUMN, ClassName.NUMBERED_COLUMN_BUTTON, tableControlsSpacing + 2, ClassName.CORNER_CONTROLS, tableControlsSpacing - tableToolbarSize + 2, "var(--ds-surface, white)", sentinelStyles, OverflowShadow(props), stickyScrollbarStyles(), ClassName.TABLE_STICKY, ClassName.TABLE_STICKY_SHADOW, tablePadding, ClassName.ROW_CONTROLS_WRAPPER, tablePadding, ClassName.COLUMN_CONTROLS_WRAPPER, tablePadding, ClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth + tablePadding - 1, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, tableOverflowShadowWidth, ClassName.TABLE_LEFT_SHADOW, ClassName.TABLE_RIGHT_SHADOW, ClassName.NODEVIEW_WRAPPER, breakoutWidthStyling(), columnControlsDecoration(props), ClassName.CORNER_CONTROLS, tableToolbarSize + 1, cornerControlHeight, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, InsertMarker(props, "\n left: -11px;\n top: 9px;\n "), ClassName.CORNER_CONTROLS, ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER, ClassName.CONTROLS_CORNER_BUTTON, tableToolbarSize + 1, tableToolbarSize + 1, tableBorderColor(props), tableBorderRadiusSize, tableHeaderCellBackgroundColor(props), ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor(props), tableToolbarSelectedColor(props), ClassName.TABLE_CONTAINER, ClassName.CORNER_CONTROLS, ClassName.CONTROLS_CORNER_BUTTON, getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1 : akEditorTableToolbarSize + akEditorTableNumberColumnWidth, ClassName.ROW_CONTROLS, ClassName.CONTROLS_BUTTON, ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, tableBorderSelectedColor(props), tableToolbarSelectedColor(props), ClassName.IS_RESIZING, ClassName.CONTROLS_CORNER_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableBorderDeleteColor(props), tableToolbarDeleteColor(props), ClassName.ROW_CONTROLS, tableToolbarSize, InsertMarker(props, "\n bottom: -1px;\n left: -11px;\n "), ClassName.ROW_CONTROLS_INNER, ClassName.ROW_CONTROLS_BUTTON_WRAP, tableBorderRadiusSize, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.ROW_CONTROLS_BUTTON_WRAP, ClassName.CONTROLS_BUTTON, akEditorUnitZIndex, HeaderButton(props, "\n border-bottom: 1px solid ".concat(tableBorderColor(props), ";\n border-right: 0px;\n border-radius: 0;\n height: 100%;\n width: ").concat(tableToolbarSize, "px;\n\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, " {\n position: absolute;\n width: 30px;\n height: 50%;\n right: 0;\n bottom: 0;\n }\n .").concat(ClassName.CONTROLS_BUTTON_OVERLAY, ":first-of-type {\n top: 0;\n }\n ")), ClassName.ROW_CONTROLS_WITH_DRAG, ClassName.DRAG_HANDLE_BUTTON_CONTAINER, floatingColumnControls(props), ClassName.IS_RESIZING, ClassName.ROW_CONTROLS, HeaderButtonHover(props), HeaderButtonDanger(props), ClassName.NUMBERED_COLUMN, getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize : akEditorTableToolbarSize - 1, getBooleanFF('platform.editor.table.drag-and-drop') ? 0 : akEditorTableToolbarSize, akEditorTableNumberColumnWidth + 1, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderColor(props), relativeFontSizeToBase16(fontSize()), tableHeaderCellBackgroundColor(props), tableTextColor(props), tableBorderColor(props), tableBorderColor(props), ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, "var(--ds-surface, white)", ClassName.WITH_CONTROLS, ClassName.CORNER_CONTROLS, ClassName.ROW_CONTROLS, ClassName.NUMBERED_COLUMN, getBooleanFF('platform.editor.custom-table-width') ? 0 : 1, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON, tableBorderSelectedColor(props), tableBorderSelectedColor(props), tableToolbarSelectedColor(props), akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.IS_RESIZING, ClassName.WITH_CONTROLS, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, ClassName.NUMBERED_COLUMN_BUTTON, ClassName.NUMBERED_COLUMN_BUTTON_DISABLED, tableBorderSelectedColor(props), tableBorderSelectedColor(props), tableToolbarSelectedColor(props), akEditorUnitZIndex, "var(--ds-text-selected, ".concat(N0, ")"), ClassName.NUMBERED_COLUMN_BUTTON, ClassName.HOVERED_CELL_IN_DANGER, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), "var(--ds-text-danger, ".concat(R500, ")"), akEditorUnitZIndex, ClassName.TABLE_NODE_WRAPPER, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, ClassName.SELECTED_CELL, ClassName.HOVERED_CELL_IN_DANGER, akEditorSmallZIndex, ClassName.SELECTED_CELL, tableBorderSelectedColor(props), ClassName.SELECTED_CELL, tableCellSelectedColor(props), akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, ClassName.HOVERED_CELL_IN_DANGER, tableCellDeleteColor(props), akEditorUnitZIndex * 100, ClassName.HOVERED_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.SELECTED_CELL, ClassName.TABLE_HEADER_CELL, ClassName.HOVERED_CELL, tableBorderSelectedColor(props), akEditorSmallZIndex, ClassName.HOVERED_CELL_IN_DANGER, tableBorderStyles(props), akEditorUnitZIndex * 100, tableRowControlStyles(), ClassName.ROW_CONTROLS_WRAPPER, ClassName.TABLE_LEFT_SHADOW, akEditorUnitZIndex, ClassName.COLUMN_CONTROLS_WRAPPER, tableMarginTop + 1, tableWrapperStyles(), ClassName.IS_RESIZING, ClassName.TABLE_NODE_WRAPPER, scrollbarStyles, ClassName.RESIZE_CURSOR, props !== null && props !== void 0 && (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.restartNumberedLists ? "" : listLargeNumericMarkersOldStyles, shadowSentinelStyles);
|
|
65
65
|
};
|
|
66
66
|
export var tableFullPageEditorStyles = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n .ProseMirror .", " > table {\n margin-left: 0;\n // 1px border width offset added here to prevent unwanted overflow and scolling - ED-16212\n margin-right: -1px;\n width: 100%;\n }\n"])), ClassName.TABLE_NODE_WRAPPER);
|
|
67
67
|
export var tableCommentEditorStyles = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n .ProseMirror .", " > table {\n margin-left: 0;\n margin-right: 0;\n ", ";\n }\n"])), ClassName.TABLE_NODE_WRAPPER, scrollbarStyles);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export var DragHandleIcon = function DragHandleIcon(_ref) {
|
|
4
|
+
var backgroundColor = _ref.backgroundColor,
|
|
5
|
+
foregroundColor = _ref.foregroundColor;
|
|
6
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
7
|
+
width: "28",
|
|
8
|
+
height: "20",
|
|
9
|
+
viewBox: "0 0 28 20",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
13
|
+
x: "1",
|
|
14
|
+
y: "1",
|
|
15
|
+
width: "26",
|
|
16
|
+
height: "18",
|
|
17
|
+
rx: "5",
|
|
18
|
+
fill: backgroundColor || '#F1F2F4'
|
|
19
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
clipPath: "url(#clip0_125_45007)"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
d: "M11 12C11 11.4477 10.5523 11 10 11C9.44772 11 9 11.4477 9 12C9 12.5523 9.44772 13 10 13C10.5523 13 11 12.5523 11 12Z",
|
|
23
|
+
fill: foregroundColor || '#626F86'
|
|
24
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
d: "M11 8C11 7.44772 10.5523 7 10 7C9.44772 7 9 7.44772 9 8C9 8.55228 9.44772 9 10 9C10.5523 9 11 8.55228 11 8Z",
|
|
26
|
+
fill: foregroundColor || '#626F86'
|
|
27
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
28
|
+
d: "M19 12C19 11.4477 18.5523 11 18 11C17.4477 11 17 11.4477 17 12C17 12.5523 17.4477 13 18 13C18.5523 13 19 12.5523 19 12Z",
|
|
29
|
+
fill: foregroundColor || '#626F86'
|
|
30
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
31
|
+
d: "M19 8C19 7.44772 18.5523 7 18 7C17.4477 7 17 7.44772 17 8C17 8.55228 17.4477 9 18 9C18.5523 9 19 8.55228 19 8Z",
|
|
32
|
+
fill: foregroundColor || '#626F86'
|
|
33
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
34
|
+
d: "M15 12C15 11.4477 14.5523 11 14 11C13.4477 11 13 11.4477 13 12C13 12.5523 13.4477 13 14 13C14.5523 13 15 12.5523 15 12Z",
|
|
35
|
+
fill: foregroundColor || '#626F86'
|
|
36
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
d: "M15 8C15 7.44772 14.5523 7 14 7C13.4477 7 13 7.44772 13 8C13 8.55228 13.4477 9 14 9C14.5523 9 15 8.55228 15 8Z",
|
|
38
|
+
fill: foregroundColor || '#626F86'
|
|
39
|
+
})), /*#__PURE__*/React.createElement("rect", {
|
|
40
|
+
x: "1",
|
|
41
|
+
y: "1",
|
|
42
|
+
width: "26",
|
|
43
|
+
height: "18",
|
|
44
|
+
rx: "5",
|
|
45
|
+
stroke: "white",
|
|
46
|
+
strokeWidth: "2"
|
|
47
|
+
}), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
48
|
+
id: "clip0_125_45007"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
50
|
+
width: "16",
|
|
51
|
+
height: "24",
|
|
52
|
+
fill: "white",
|
|
53
|
+
transform: "matrix(0 -1 1 0 2 18)"
|
|
54
|
+
}))));
|
|
55
|
+
};
|
|
@@ -279,6 +279,7 @@ export declare const TableCssClassName: {
|
|
|
279
279
|
/** Controls with drag handle */
|
|
280
280
|
COLUMN_CONTROLS_DECORATIONS_WITH_DRAG: string;
|
|
281
281
|
ROW_CONTROLS_WITH_DRAG: string;
|
|
282
|
+
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
282
283
|
/** Other classes */
|
|
283
284
|
NUMBERED_COLUMN: string;
|
|
284
285
|
NUMBERED_COLUMN_BUTTON: string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { MouseEventHandler } from 'react';
|
|
2
|
+
type DragHandleState = 'default' | 'selected' | 'disabled' | 'danger';
|
|
2
3
|
type DragHandleProps = {
|
|
3
4
|
tableLocalId: string;
|
|
4
5
|
indexes: number[];
|
|
6
|
+
previewWidth?: number;
|
|
7
|
+
previewHeight?: number;
|
|
5
8
|
direction?: 'column' | 'row';
|
|
9
|
+
state?: DragHandleState;
|
|
6
10
|
onClick?: MouseEventHandler;
|
|
7
11
|
onMouseOver?: MouseEventHandler;
|
|
8
12
|
onMouseOut?: MouseEventHandler;
|
|
9
13
|
};
|
|
10
|
-
export declare const DragHandle: ({ tableLocalId, direction, indexes, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
14
|
+
export declare const DragHandle: ({ tableLocalId, direction, state, indexes, previewWidth, previewHeight, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
11
15
|
export {};
|
|
@@ -279,6 +279,7 @@ export declare const TableCssClassName: {
|
|
|
279
279
|
/** Controls with drag handle */
|
|
280
280
|
COLUMN_CONTROLS_DECORATIONS_WITH_DRAG: string;
|
|
281
281
|
ROW_CONTROLS_WITH_DRAG: string;
|
|
282
|
+
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
282
283
|
/** Other classes */
|
|
283
284
|
NUMBERED_COLUMN: string;
|
|
284
285
|
NUMBERED_COLUMN_BUTTON: string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { MouseEventHandler } from 'react';
|
|
2
|
+
type DragHandleState = 'default' | 'selected' | 'disabled' | 'danger';
|
|
2
3
|
type DragHandleProps = {
|
|
3
4
|
tableLocalId: string;
|
|
4
5
|
indexes: number[];
|
|
6
|
+
previewWidth?: number;
|
|
7
|
+
previewHeight?: number;
|
|
5
8
|
direction?: 'column' | 'row';
|
|
9
|
+
state?: DragHandleState;
|
|
6
10
|
onClick?: MouseEventHandler;
|
|
7
11
|
onMouseOver?: MouseEventHandler;
|
|
8
12
|
onMouseOut?: MouseEventHandler;
|
|
9
13
|
};
|
|
10
|
-
export declare const DragHandle: ({ tableLocalId, direction, indexes, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
14
|
+
export declare const DragHandle: ({ tableLocalId, direction, state, indexes, previewWidth, previewHeight, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
11
15
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.7",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^0.0.2",
|
|
32
|
-
"@atlaskit/editor-common": "^76.
|
|
32
|
+
"@atlaskit/editor-common": "^76.13.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.1",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
41
41
|
"@atlaskit/pragmatic-drag-and-drop": "^0.23.0",
|
|
42
42
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.11.8",
|
|
43
|
-
"@atlaskit/pragmatic-drag-and-drop-react-accessibility": "^0.4.0",
|
|
44
43
|
"@atlaskit/primitives": "^1.6.7",
|
|
45
44
|
"@atlaskit/theme": "^12.6.0",
|
|
46
45
|
"@atlaskit/tokens": "^1.28.0",
|
|
@@ -300,8 +300,8 @@ export const TableCssClassName = {
|
|
|
300
300
|
|
|
301
301
|
/** Controls with drag handle */
|
|
302
302
|
COLUMN_CONTROLS_DECORATIONS_WITH_DRAG: `${tablePrefixSelector}-column-controls-decoration-with-drag`,
|
|
303
|
-
|
|
304
303
|
ROW_CONTROLS_WITH_DRAG: `${tablePrefixSelector}-row-controls-with-drag`,
|
|
304
|
+
DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
|
|
305
305
|
|
|
306
306
|
/** Other classes */
|
|
307
307
|
NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
|
|
@@ -1,30 +1,61 @@
|
|
|
1
1
|
import type { MouseEventHandler } from 'react';
|
|
2
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
3
5
|
|
|
4
|
-
import { DragHandleButton } from '@atlaskit/pragmatic-drag-and-drop-react-accessibility/drag-handle-button';
|
|
5
6
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
7
|
+
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
8
|
+
import { N200, N700 } from '@atlaskit/theme/colors';
|
|
6
9
|
import { token } from '@atlaskit/tokens';
|
|
7
10
|
|
|
11
|
+
import { TableCssClassName as ClassName } from '../../types';
|
|
12
|
+
import { DragPreview } from '../DragPreview';
|
|
13
|
+
import { DragHandleIcon } from '../icons/DragHandleIcon';
|
|
14
|
+
|
|
15
|
+
type DragHandleState = 'default' | 'selected' | 'disabled' | 'danger';
|
|
16
|
+
|
|
8
17
|
type DragHandleProps = {
|
|
9
18
|
tableLocalId: string;
|
|
10
19
|
indexes: number[];
|
|
20
|
+
previewWidth?: number;
|
|
21
|
+
previewHeight?: number;
|
|
11
22
|
direction?: 'column' | 'row';
|
|
23
|
+
state?: DragHandleState;
|
|
12
24
|
onClick?: MouseEventHandler;
|
|
13
25
|
onMouseOver?: MouseEventHandler;
|
|
14
26
|
onMouseOut?: MouseEventHandler;
|
|
15
27
|
};
|
|
16
28
|
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
const mapStateToProps = (state: DragHandleState) => {
|
|
30
|
+
switch (state) {
|
|
31
|
+
case 'danger':
|
|
32
|
+
case 'disabled':
|
|
33
|
+
case 'selected':
|
|
34
|
+
case 'default':
|
|
35
|
+
default:
|
|
36
|
+
return {
|
|
37
|
+
backgroundColor: token('color.background.accent.gray.subtlest', N200),
|
|
38
|
+
foregroundColor: token('color.icon.subtle', N700),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
19
43
|
export const DragHandle = ({
|
|
20
44
|
tableLocalId,
|
|
21
45
|
direction = 'row',
|
|
46
|
+
state = 'default',
|
|
22
47
|
indexes,
|
|
48
|
+
previewWidth,
|
|
49
|
+
previewHeight,
|
|
23
50
|
onClick,
|
|
24
51
|
onMouseOver,
|
|
25
52
|
onMouseOut,
|
|
26
53
|
}: DragHandleProps) => {
|
|
27
|
-
const dragHandleDivRef = useRef<
|
|
54
|
+
const dragHandleDivRef = useRef<HTMLButtonElement>(null);
|
|
55
|
+
const iconProps = mapStateToProps(state);
|
|
56
|
+
const [previewContainer, setPreviewContainer] = useState<HTMLElement | null>(
|
|
57
|
+
null,
|
|
58
|
+
);
|
|
28
59
|
|
|
29
60
|
useEffect(() => {
|
|
30
61
|
const dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
@@ -38,20 +69,50 @@ export const DragHandle = ({
|
|
|
38
69
|
indexes,
|
|
39
70
|
};
|
|
40
71
|
},
|
|
72
|
+
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
73
|
+
setCustomNativeDragPreview({
|
|
74
|
+
getOffset: ({ container }) => {
|
|
75
|
+
const rect = container.getBoundingClientRect();
|
|
76
|
+
if (direction === 'row') {
|
|
77
|
+
return { x: 16, y: 16 };
|
|
78
|
+
} else {
|
|
79
|
+
return { x: rect.width / 2 + 16, y: 16 };
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
render: function render({ container }) {
|
|
83
|
+
setPreviewContainer(container);
|
|
84
|
+
return () => setPreviewContainer(null);
|
|
85
|
+
},
|
|
86
|
+
nativeSetDragImage,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
41
89
|
});
|
|
42
90
|
}
|
|
43
91
|
}, [tableLocalId, direction, indexes]);
|
|
92
|
+
|
|
44
93
|
return (
|
|
45
|
-
<
|
|
94
|
+
<button
|
|
95
|
+
className={ClassName.DRAG_HANDLE_BUTTON_CONTAINER}
|
|
46
96
|
ref={dragHandleDivRef}
|
|
47
97
|
style={{
|
|
48
98
|
backgroundColor: `${token('elevation.surface', 'white')}`,
|
|
49
99
|
borderRadius: '4px',
|
|
50
100
|
border: `2px solid ${token('elevation.surface', 'white')}`,
|
|
51
|
-
transform: direction === 'column' ? '
|
|
101
|
+
transform: direction === 'column' ? 'none' : 'rotate(90deg)',
|
|
52
102
|
}}
|
|
53
103
|
>
|
|
54
|
-
<
|
|
55
|
-
|
|
104
|
+
<DragHandleIcon {...iconProps} />
|
|
105
|
+
{previewContainer &&
|
|
106
|
+
previewWidth !== undefined &&
|
|
107
|
+
previewHeight !== undefined &&
|
|
108
|
+
ReactDOM.createPortal(
|
|
109
|
+
<DragPreview
|
|
110
|
+
direction={direction}
|
|
111
|
+
width={previewWidth}
|
|
112
|
+
height={previewHeight}
|
|
113
|
+
/>,
|
|
114
|
+
previewContainer,
|
|
115
|
+
)}
|
|
116
|
+
</button>
|
|
56
117
|
);
|
|
57
118
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
4
|
|
|
5
|
-
import { DragInMotionIcon } from '../
|
|
5
|
+
import { DragInMotionIcon } from '../icons/DragInMotionIcon';
|
|
6
6
|
|
|
7
7
|
const boxStyles = xcss({
|
|
8
8
|
borderColor: 'color.border.focused',
|
|
@@ -29,7 +29,10 @@ const DragControlsComponent = ({
|
|
|
29
29
|
editorView,
|
|
30
30
|
}: DragControlsProps & WrappedComponentProps) => {
|
|
31
31
|
const rowHeights = getRowHeights(tableRef);
|
|
32
|
-
const heights = rowHeights
|
|
32
|
+
const heights = rowHeights
|
|
33
|
+
.map((height, index) => `${height - 1}px`)
|
|
34
|
+
.join(' ');
|
|
35
|
+
const rowWidth = tableRef.offsetWidth;
|
|
33
36
|
|
|
34
37
|
const onClick = (
|
|
35
38
|
index: number,
|
|
@@ -53,10 +56,11 @@ const DragControlsComponent = ({
|
|
|
53
56
|
gridTemplateRows: heights,
|
|
54
57
|
}}
|
|
55
58
|
>
|
|
56
|
-
{Number.isFinite(rowIndex) && (
|
|
59
|
+
{rowIndex !== undefined && Number.isFinite(rowIndex) && (
|
|
57
60
|
<div
|
|
58
61
|
style={{
|
|
59
62
|
gridRow: `${(rowIndex as number) + 1} / span 1`,
|
|
63
|
+
display: 'flex',
|
|
60
64
|
}}
|
|
61
65
|
>
|
|
62
66
|
<DragHandle
|
|
@@ -64,7 +68,9 @@ const DragControlsComponent = ({
|
|
|
64
68
|
onMouseOver={onMouseOver}
|
|
65
69
|
onMouseOut={onMouseOut}
|
|
66
70
|
tableLocalId={getLocalId()}
|
|
67
|
-
indexes={[]}
|
|
71
|
+
indexes={[rowIndex]}
|
|
72
|
+
previewWidth={rowWidth}
|
|
73
|
+
previewHeight={rowHeights[rowIndex]}
|
|
68
74
|
/>
|
|
69
75
|
</div>
|
|
70
76
|
)}
|
|
@@ -133,7 +133,7 @@ export default class TableFloatingControls extends Component<Props, State> {
|
|
|
133
133
|
: undefined;
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
|
-
<div onMouseDown={(e) => e.preventDefault()}>
|
|
136
|
+
<div onMouseDown={(e) => !isDragAndDropEnabled && e.preventDefault()}>
|
|
137
137
|
{isNumberColumnEnabled ? (
|
|
138
138
|
<NumberColumn
|
|
139
139
|
editorView={editorView}
|