@atlaskit/editor-plugin-table 7.1.0 → 7.1.1
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 +10 -0
- package/dist/cjs/event-handlers.js +4 -1
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +9 -9
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +4 -11
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/cjs/pm-plugins/drag-and-drop/utils/monitor.js +0 -5
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/ui/DragHandle/index.js +27 -9
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -3
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +3 -1
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +1 -7
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +0 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +6 -1
- package/dist/cjs/ui/common-styles.js +2 -1
- package/dist/cjs/ui/consts.js +3 -3
- package/dist/cjs/ui/ui-styles.js +8 -8
- package/dist/cjs/utils/drag-menu.js +42 -29
- package/dist/es2019/event-handlers.js +3 -2
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +8 -8
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +5 -10
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/es2019/pm-plugins/drag-and-drop/utils/monitor.js +0 -5
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/DragHandle/index.js +26 -8
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/index.js +5 -4
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +3 -3
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +1 -7
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +0 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +6 -1
- package/dist/es2019/ui/common-styles.js +24 -5
- package/dist/es2019/ui/consts.js +2 -2
- package/dist/es2019/ui/ui-styles.js +8 -8
- package/dist/es2019/utils/drag-menu.js +29 -24
- package/dist/esm/event-handlers.js +5 -2
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +9 -9
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +5 -12
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/esm/pm-plugins/drag-and-drop/utils/monitor.js +0 -5
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/DragHandle/index.js +27 -9
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/index.js +5 -4
- package/dist/esm/ui/FloatingContextualMenu/styles.js +4 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +1 -7
- package/dist/esm/ui/TableFloatingColumnControls/index.js +0 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +6 -1
- package/dist/esm/ui/common-styles.js +2 -1
- package/dist/esm/ui/consts.js +2 -2
- package/dist/esm/ui/ui-styles.js +8 -8
- package/dist/esm/utils/drag-menu.js +41 -28
- package/dist/types/types.d.ts +1 -0
- package/dist/types/ui/FloatingContextualMenu/styles.d.ts +1 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +0 -2
- package/dist/types/ui/consts.d.ts +2 -1
- package/dist/types/ui/ui-styles.d.ts +2 -2
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +0 -2
- package/dist/types-ts4.5/ui/consts.d.ts +2 -1
- package/dist/types-ts4.5/ui/ui-styles.d.ts +2 -2
- package/package.json +3 -5
- package/src/__tests__/unit/event-handlers.ts +3 -17
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +46 -17
- package/src/event-handlers.ts +14 -2
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -8
- package/src/pm-plugins/drag-and-drop/commands.ts +5 -33
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -3
- package/src/pm-plugins/drag-and-drop/utils/monitor.ts +0 -5
- package/src/types.ts +1 -0
- package/src/ui/DragHandle/index.tsx +33 -14
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +9 -2
- package/src/ui/FloatingContextualMenu/index.tsx +10 -3
- package/src/ui/FloatingContextualMenu/styles.ts +10 -3
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +13 -4
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +1 -13
- package/src/ui/TableFloatingColumnControls/index.tsx +0 -2
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +16 -7
- package/src/ui/common-styles.ts +20 -4
- package/src/ui/consts.ts +2 -6
- package/src/ui/ui-styles.ts +12 -8
- package/src/utils/drag-menu.ts +48 -32
- package/tsconfig.json +273 -0
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { akEditorTableBorder, akEditorTableBorderSelected, akEditorTableCellBlanketDeleted, akEditorTableCellBlanketSelected, akEditorTableHeaderCellBackground, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { B200, N0, N20, N200, N20A, N300, R300, R400, R75 } from '@atlaskit/theme/colors';
|
|
5
4
|
import { RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
|
|
6
5
|
|
|
@@ -50,7 +49,8 @@ export const resizeHandlerAreaWidth = RESIZE_HANDLE_AREA_DECORATION_GAP / 3;
|
|
|
50
49
|
export const resizeLineWidth = 2;
|
|
51
50
|
export const resizeHandlerZIndex = columnControlsZIndex + akRichMediaResizeZIndex;
|
|
52
51
|
export const contextualMenuTriggerSize = 16;
|
|
53
|
-
export const contextualMenuDropdownWidth =
|
|
52
|
+
export const contextualMenuDropdownWidth = 180;
|
|
53
|
+
export const contextualMenuDropdownWidthDnD = 250;
|
|
54
54
|
export const stickyRowZIndex = resizeHandlerZIndex + 2;
|
|
55
55
|
export const stickyRowOffsetTop = 8;
|
|
56
56
|
export const stickyHeaderBorderBottomWidth = 1;
|
|
@@ -264,7 +264,7 @@ export const DeleteButton = () => css`
|
|
|
264
264
|
cursor: pointer;
|
|
265
265
|
}
|
|
266
266
|
`;
|
|
267
|
-
export const OverflowShadow =
|
|
267
|
+
export const OverflowShadow = isDragAndDropEnabled => css`
|
|
268
268
|
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
269
269
|
display: block;
|
|
270
270
|
height: calc(100% - ${tableMarginTop}px);
|
|
@@ -306,14 +306,14 @@ export const OverflowShadow = () => css`
|
|
|
306
306
|
left: ${getBooleanFF('platform.editor.custom-table-width') ? `calc(100% - ${getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide : tableOverflowShadowWidth}px)` : `calc(100% - ${getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide - 10 : -2}px)`};
|
|
307
307
|
}
|
|
308
308
|
.${ClassName.WITH_CONTROLS} {
|
|
309
|
-
${overflowShadowWidhoutDnD()}
|
|
309
|
+
${overflowShadowWidhoutDnD(isDragAndDropEnabled)}
|
|
310
310
|
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
311
311
|
border-left: 1px solid ${tableBorderColor};
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
`;
|
|
315
|
-
const overflowShadowWidhoutDnD =
|
|
316
|
-
if (!
|
|
315
|
+
const overflowShadowWidhoutDnD = isDragAndDropEnabled => {
|
|
316
|
+
if (!isDragAndDropEnabled) {
|
|
317
317
|
return css`
|
|
318
318
|
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
319
319
|
height: calc(100% - ${tableMarginTopWithControl}px);
|
|
@@ -680,8 +680,8 @@ const getLastColumnResizerOverrides = () => {
|
|
|
680
680
|
}
|
|
681
681
|
` : '';
|
|
682
682
|
};
|
|
683
|
-
const resizeHandleOverrides =
|
|
684
|
-
if (
|
|
683
|
+
const resizeHandleOverrides = isDragAndDropEnabled => {
|
|
684
|
+
if (isDragAndDropEnabled) {
|
|
685
685
|
return css`
|
|
686
686
|
th.${ClassName.WITH_RESIZE_LINE}::before,
|
|
687
687
|
td.${ClassName.WITH_RESIZE_LINE}::before {
|
|
@@ -754,7 +754,7 @@ const resizeHandleOverrides = () => {
|
|
|
754
754
|
}
|
|
755
755
|
`;
|
|
756
756
|
};
|
|
757
|
-
export const resizeHandle =
|
|
757
|
+
export const resizeHandle = isDragAndDropEnabled => css`
|
|
758
758
|
.${ClassName.TABLE_CONTAINER} {
|
|
759
759
|
.${ClassName.RESIZE_HANDLE_DECORATION} {
|
|
760
760
|
background-color: transparent;
|
|
@@ -769,7 +769,7 @@ export const resizeHandle = () => css`
|
|
|
769
769
|
|
|
770
770
|
${getLastColumnResizerOverrides()}
|
|
771
771
|
|
|
772
|
-
${resizeHandleOverrides()}
|
|
772
|
+
${resizeHandleOverrides(isDragAndDropEnabled)}
|
|
773
773
|
|
|
774
774
|
table
|
|
775
775
|
tr:first-of-type
|
|
@@ -18,7 +18,7 @@ import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizi
|
|
|
18
18
|
import { getClosestSelectionRect } from '../toolbar';
|
|
19
19
|
import { deleteRows } from '../transforms';
|
|
20
20
|
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
21
|
-
import { getSelectedColumnIndexes } from './
|
|
21
|
+
import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
22
22
|
const canDecrease = (index, min = 0) => index !== undefined && index > min;
|
|
23
23
|
const canIncrease = (index, max = 0) => index !== undefined && index < max;
|
|
24
24
|
const isDistributeColumnsEnabled = state => {
|
|
@@ -53,34 +53,38 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
53
53
|
}];
|
|
54
54
|
const moveOptions = direction === 'row' ? [{
|
|
55
55
|
label: 'up',
|
|
56
|
-
offset: -1,
|
|
57
|
-
canMove: index => canDrag && canDecrease(index),
|
|
58
56
|
icon: ArrowUpIcon,
|
|
59
|
-
keymap: moveRowUp
|
|
57
|
+
keymap: moveRowUp,
|
|
58
|
+
canMove: selectionRect => canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top),
|
|
59
|
+
getOriginIndexes: getSelectedRowIndexes,
|
|
60
|
+
getTargetIndex: selectionRect => selectionRect.top - 1
|
|
60
61
|
}, {
|
|
61
62
|
label: 'down',
|
|
62
|
-
offset: 1,
|
|
63
|
-
canMove: index => {
|
|
64
|
-
var _tableMap$height;
|
|
65
|
-
return canDrag && canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
66
|
-
},
|
|
67
63
|
icon: ArrowDownIcon,
|
|
68
|
-
keymap: moveRowDown
|
|
64
|
+
keymap: moveRowDown,
|
|
65
|
+
canMove: selectionRect => {
|
|
66
|
+
var _selectionRect$bottom, _tableMap$height;
|
|
67
|
+
return canDrag && canIncrease(((_selectionRect$bottom = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.bottom) !== null && _selectionRect$bottom !== void 0 ? _selectionRect$bottom : 0) - 1, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
68
|
+
},
|
|
69
|
+
getOriginIndexes: getSelectedRowIndexes,
|
|
70
|
+
getTargetIndex: selectionRect => selectionRect.bottom
|
|
69
71
|
}] : [{
|
|
70
72
|
label: 'left',
|
|
71
|
-
offset: -1,
|
|
72
|
-
canMove: index => canDrag && canDecrease(index),
|
|
73
73
|
icon: ArrowLeftIcon,
|
|
74
|
-
keymap: moveColumnLeft
|
|
74
|
+
keymap: moveColumnLeft,
|
|
75
|
+
canMove: selectionRect => canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.left),
|
|
76
|
+
getOriginIndexes: getSelectedColumnIndexes,
|
|
77
|
+
getTargetIndex: selectionRect => selectionRect.left - 1
|
|
75
78
|
}, {
|
|
76
79
|
label: 'right',
|
|
77
|
-
offset: 1,
|
|
78
|
-
canMove: index => {
|
|
79
|
-
var _tableMap$width;
|
|
80
|
-
return canDrag && canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
81
|
-
},
|
|
82
80
|
icon: ArrowRightIcon,
|
|
83
|
-
keymap: moveColumnRight
|
|
81
|
+
keymap: moveColumnRight,
|
|
82
|
+
canMove: selectionRect => {
|
|
83
|
+
var _selectionRect$right, _tableMap$width;
|
|
84
|
+
return canDrag && canIncrease(((_selectionRect$right = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right) !== null && _selectionRect$right !== void 0 ? _selectionRect$right : 0) - 1, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
85
|
+
},
|
|
86
|
+
getOriginIndexes: getSelectedColumnIndexes,
|
|
87
|
+
getTargetIndex: selectionRect => selectionRect.right
|
|
84
88
|
}];
|
|
85
89
|
const sortOptions = direction === 'column' ? [{
|
|
86
90
|
label: 'increasing',
|
|
@@ -154,19 +158,20 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
154
158
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
155
159
|
}, ...moveOptions.map(({
|
|
156
160
|
label,
|
|
157
|
-
offset,
|
|
158
161
|
canMove,
|
|
159
162
|
icon,
|
|
160
|
-
keymap
|
|
163
|
+
keymap,
|
|
164
|
+
getOriginIndexes,
|
|
165
|
+
getTargetIndex
|
|
161
166
|
}) => ({
|
|
162
167
|
id: `move_${direction}_${label}`,
|
|
163
168
|
title: `Move ${direction} ${label}`,
|
|
164
|
-
disabled: !canMove(
|
|
169
|
+
disabled: !canMove(selectionRect),
|
|
165
170
|
icon,
|
|
166
171
|
onClick: (state, dispatch) => {
|
|
167
|
-
if (canMove(
|
|
172
|
+
if (canMove(selectionRect)) {
|
|
168
173
|
requestAnimationFrame(() => {
|
|
169
|
-
moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`,
|
|
174
|
+
moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`, getOriginIndexes(selectionRect), getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
|
|
170
175
|
});
|
|
171
176
|
return true;
|
|
172
177
|
}
|
|
@@ -10,7 +10,7 @@ import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-
|
|
|
10
10
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
11
11
|
import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
|
|
12
12
|
import { deleteColumns, deleteRows } from './transforms';
|
|
13
|
-
import { RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
|
|
13
|
+
import { TableCssClassName as ClassName, RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
|
|
14
14
|
import { convertHTMLCellIndexToColumnIndex, getColumnIndexMappedToColumnIndexInFirstRow, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragCornerButton, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
|
|
15
15
|
import { getAllowAddColumnCustomStep } from './utils/get-allow-add-column-custom-step';
|
|
16
16
|
var isFocusingCalendar = function isFocusingCalendar(event) {
|
|
@@ -25,12 +25,15 @@ var isFocusingFloatingToolbar = function isFocusingFloatingToolbar(event) {
|
|
|
25
25
|
var isFocusingDragHandles = function isFocusingDragHandles(event) {
|
|
26
26
|
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.getAttribute('draggable') === 'true';
|
|
27
27
|
};
|
|
28
|
+
var isFocusingDragHandlesClickableZone = function isFocusingDragHandlesClickableZone(event) {
|
|
29
|
+
return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.classList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE);
|
|
30
|
+
};
|
|
28
31
|
export var handleBlur = function handleBlur(view, event) {
|
|
29
32
|
var state = view.state,
|
|
30
33
|
dispatch = view.dispatch;
|
|
31
34
|
// IE version check for ED-4665
|
|
32
35
|
// Calendar focus check for ED-10466
|
|
33
|
-
if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event)) {
|
|
36
|
+
if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
|
|
34
37
|
setEditorFocus(false)(state, dispatch);
|
|
35
38
|
}
|
|
36
39
|
event.preventDefault();
|
|
@@ -39,6 +39,7 @@ export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnal
|
|
|
39
39
|
return function (inputMethod, sourceType, sourceIndexes, targetIndex, tr) {
|
|
40
40
|
return withEditorAnalyticsAPI(function (_ref2) {
|
|
41
41
|
var selection = _ref2.selection;
|
|
42
|
+
var direction = sourceIndexes[0] > targetIndex ? -1 : 1;
|
|
42
43
|
var _getSelectedTableInfo2 = getSelectedTableInfo(selection),
|
|
43
44
|
totalRowCount = _getSelectedTableInfo2.totalRowCount,
|
|
44
45
|
totalColumnCount = _getSelectedTableInfo2.totalColumnCount;
|
|
@@ -52,8 +53,8 @@ export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnal
|
|
|
52
53
|
// This identifies the total amount of row/cols the move operation covered. The distance covered should be a representaion
|
|
53
54
|
// of the minimum distance. This will account for large selection being moved causing a large distance travelled value.
|
|
54
55
|
distance: Math.min.apply(Math, _toConsumableArray(sourceIndexes.map(function (v) {
|
|
55
|
-
return targetIndex - v;
|
|
56
|
-
}))),
|
|
56
|
+
return Math.abs(targetIndex - v);
|
|
57
|
+
}))) * direction,
|
|
57
58
|
// If a drop doesn't actually change anything then we're going to mark the event as cancelled.
|
|
58
59
|
status: sourceIndexes.includes(targetIndex) ? TABLE_STATUS.CANCELLED : TABLE_STATUS.SUCCESS,
|
|
59
60
|
totalRowCount: totalRowCount,
|
|
@@ -80,15 +81,14 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
|
|
|
80
81
|
}
|
|
81
82
|
var isRow = sourceType === 'table-row';
|
|
82
83
|
var selectedIndexes = isRow ? getSelectedRowIndexes(selectionRect) : getSelectedColumnIndexes(selectionRect);
|
|
83
|
-
|
|
84
|
-
// FIXME: We can move if only one row/column selected
|
|
85
|
-
if (selectedIndexes.length === 0 || selectedIndexes.length > 1) {
|
|
84
|
+
if (selectedIndexes.length === 0) {
|
|
86
85
|
return false;
|
|
87
86
|
}
|
|
88
|
-
|
|
87
|
+
|
|
88
|
+
// const sourceIndex = selectedIndexes[0];
|
|
89
89
|
// we can move only by one row/column
|
|
90
90
|
// 'direction' can only be 1 (for right or down) or -1 (for left or up)
|
|
91
|
-
var targetIndex =
|
|
91
|
+
var targetIndex = Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
|
|
92
92
|
|
|
93
93
|
// We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
|
|
94
94
|
var _getSelectedTableInfo3 = getSelectedTableInfo(selection),
|
|
@@ -100,7 +100,7 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// We can move only if there are no merged cells in the source or target row/column
|
|
103
|
-
var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(
|
|
103
|
+
var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
|
|
104
104
|
if (hasMergedCellsInSource) {
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
@@ -108,7 +108,7 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
|
|
|
108
108
|
if (hasMergedCellsInTarget) {
|
|
109
109
|
return false;
|
|
110
110
|
}
|
|
111
|
-
return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType,
|
|
111
|
+
return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
1
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { moveColumn, moveRow
|
|
2
|
+
import { moveColumn, moveRow } from '@atlaskit/editor-tables/utils';
|
|
4
3
|
import { TableDecorations } from '../../types';
|
|
5
4
|
import { createColumnInsertLine, createRowInsertLine, updateDecorations } from '../../utils';
|
|
6
|
-
import { combineTransforms } from '../../utils/transforms';
|
|
7
5
|
import { DragAndDropActionType } from './actions';
|
|
8
6
|
import { DropTargetType } from './consts';
|
|
9
7
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
@@ -74,15 +72,10 @@ export var moveSource = function moveSource(sourceType, sourceIndexes, targetInd
|
|
|
74
72
|
if (sourceIndexes.includes(targetIndex)) {
|
|
75
73
|
return nextTr.setMeta('addToHistory', false);
|
|
76
74
|
}
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
var isTableRow = sourceType === 'table-row';
|
|
82
|
-
if (isTableRow) {
|
|
83
|
-
return combineTransforms([moveRow(state, sourceIndexes, targetIndex), selectStartOfTable, selectRow(targetIndex)], nextTr);
|
|
84
|
-
}
|
|
85
|
-
return combineTransforms([moveColumn(state, sourceIndexes, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
|
|
75
|
+
var move = sourceType === 'table-row' ? moveRow : moveColumn;
|
|
76
|
+
return move(state, sourceIndexes, targetIndex, {
|
|
77
|
+
selectAfterMove: true
|
|
78
|
+
})(nextTr);
|
|
86
79
|
});
|
|
87
80
|
};
|
|
88
81
|
export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
|
|
@@ -55,10 +55,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI) {
|
|
|
55
55
|
indexes = _ref6.indexes;
|
|
56
56
|
|
|
57
57
|
// First; Perform any quick checks so we can abort early.
|
|
58
|
-
if (!indexes || !localId ||
|
|
59
|
-
// FIXME: We currently don't support DragNDrop of multiple elements. For now we will not bother to monitor drags
|
|
60
|
-
// of more then 1 item.
|
|
61
|
-
indexes.length !== 1 || !(type === 'table-row' || type === 'table-column')) {
|
|
58
|
+
if (!indexes || !localId || !(type === 'table-row' || type === 'table-column')) {
|
|
62
59
|
return false;
|
|
63
60
|
}
|
|
64
61
|
var _getTablePluginState = getTablePluginState(editorView.state),
|
|
@@ -30,11 +30,6 @@ export var getDraggableDataFromEvent = function getDraggableDataFromEvent(_ref)
|
|
|
30
30
|
sourceLocalId !== targetLocalId) {
|
|
31
31
|
return undefined;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
// FIXME: currently we only support a single row/col index being moved, remove this clause when this is no longer the case.
|
|
35
|
-
if (sourceIndexes.length > 1) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
33
|
var targetClosestEdge = (_extractClosestEdge = extractClosestEdge(destination.data)) !== null && _extractClosestEdge !== void 0 ? _extractClosestEdge : targetType === 'table-row' ? 'top' : 'left';
|
|
39
34
|
// NOTE: By default we always insert row/cols at the target index to the top/left (retrospectively of row/cols).
|
|
40
35
|
// This introduces an offset in the event the drop occured closer to the bottom/right of the target. We want
|
package/dist/esm/types.js
CHANGED
|
@@ -93,6 +93,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
93
93
|
DRAG_COLUMN_DROP_TARGET_CONTROLS: "".concat(tablePrefixSelector, "-col-drop-target-controls"),
|
|
94
94
|
DRAG_COLUMN_CONTROLS_INNER: "".concat(tablePrefixSelector, "-col-controls__inner"),
|
|
95
95
|
DRAG_HANDLE_BUTTON_CONTAINER: "".concat(tablePrefixSelector, "-drag-handle-button-container"),
|
|
96
|
+
DRAG_HANDLE_BUTTON_CLICKABLE_ZONE: "".concat(tablePrefixSelector, "-drag-handle-button-clickable-zone"),
|
|
96
97
|
DRAG_CORNER_BUTTON: "".concat(tablePrefixSelector, "-drag-corner-button"),
|
|
97
98
|
DRAG_CORNER_BUTTON_INNER: "".concat(tablePrefixSelector, "-drag-corner-button-inner"),
|
|
98
99
|
/** disabled classes */
|
|
@@ -11,6 +11,7 @@ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/ut
|
|
|
11
11
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
12
12
|
import { TableCssClassName as ClassName } from '../../types';
|
|
13
13
|
import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
14
|
+
import { dragTableInsertColumnButtonSize } from '../consts';
|
|
14
15
|
import { DragPreview } from '../DragPreview';
|
|
15
16
|
import { HandleIconComponent } from './HandleIconComponent';
|
|
16
17
|
var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
@@ -42,11 +43,13 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
42
43
|
hoveredColumns = _getPluginState.hoveredColumns,
|
|
43
44
|
hoveredRows = _getPluginState.hoveredRows;
|
|
44
45
|
var selection = editorView.state.selection;
|
|
45
|
-
var
|
|
46
|
-
var
|
|
46
|
+
var isRow = direction === 'row';
|
|
47
|
+
var isColumn = direction === 'column';
|
|
48
|
+
var isRowHandleHovered = isRow && hoveredRows.length > 0;
|
|
49
|
+
var isColumnHandleHovered = isColumn && hoveredColumns.length > 0;
|
|
47
50
|
var hasMergedCells = useMemo(function () {
|
|
48
|
-
return
|
|
49
|
-
}, [indexes,
|
|
51
|
+
return isRow ? hasMergedCellsInRow(indexes[0])(selection) : hasMergedCellsInColumn(indexes[0])(selection);
|
|
52
|
+
}, [indexes, isRow, selection]);
|
|
50
53
|
var handleIconProps = {
|
|
51
54
|
forceDefaultHandle: forceDefaultHandle,
|
|
52
55
|
isColumnHandleHovered: isColumnHandleHovered,
|
|
@@ -83,7 +86,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
83
86
|
// be generated.
|
|
84
87
|
container.style.left = "-".concat(rect.width - 0.0001, "px");
|
|
85
88
|
}
|
|
86
|
-
if (
|
|
89
|
+
if (isRow) {
|
|
87
90
|
return {
|
|
88
91
|
x: 12,
|
|
89
92
|
y: rect.height / 2
|
|
@@ -107,17 +110,32 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
107
110
|
}
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
|
-
}, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells, _canDrag]);
|
|
111
|
-
var showDragMenuAnchorId =
|
|
113
|
+
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells, _canDrag]);
|
|
114
|
+
var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
112
115
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
116
|
+
className: ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
|
|
117
|
+
"data-testid": "table-drag-handle-clickable-zone-button",
|
|
118
|
+
style: {
|
|
119
|
+
height: isRow ? "calc(100% - ".concat(dragTableInsertColumnButtonSize, "px)") : "var(--ds-space-200, 16px)",
|
|
120
|
+
// 16px here because it's the size of drag handle button's large side
|
|
121
|
+
width: isRow ? "var(--ds-space-200, 16px)" // 16px here because it's the size of drag handle button's large side
|
|
122
|
+
: "calc(100% - ".concat(dragTableInsertColumnButtonSize, "px)"),
|
|
123
|
+
left: isRow ? '3px' : undefined,
|
|
124
|
+
bottom: isColumn ? '0' : undefined,
|
|
125
|
+
alignSelf: isColumn ? 'none' : 'center',
|
|
126
|
+
zIndex: isColumn ? '-1' : 'auto'
|
|
127
|
+
},
|
|
128
|
+
onClick: onClick
|
|
129
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
113
130
|
id: isDragMenuTarget ? showDragMenuAnchorId : undefined,
|
|
114
131
|
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, !_canDrag || hasMergedCells)),
|
|
115
132
|
ref: dragHandleDivRef,
|
|
116
133
|
style: {
|
|
117
|
-
transform:
|
|
134
|
+
transform: isColumn ? 'none' : 'rotate(90deg)',
|
|
135
|
+
alignSelf: isColumn ? 'none' : 'center'
|
|
118
136
|
},
|
|
119
137
|
"data-testid": "table-drag-handle-button",
|
|
120
|
-
"aria-label": formatMessage(
|
|
138
|
+
"aria-label": formatMessage(isRow ? messages.rowDragHandle : messages.columnDragHandle),
|
|
121
139
|
onMouseOver: onMouseOver,
|
|
122
140
|
onMouseOut: onMouseOut,
|
|
123
141
|
onMouseUp: function onMouseUp(e) {
|
|
@@ -37,7 +37,7 @@ import { getNewResizeStateFromSelectedColumns } from '../../pm-plugins/table-res
|
|
|
37
37
|
import { canMergeCells } from '../../transforms';
|
|
38
38
|
import { TableCssClassName as ClassName } from '../../types';
|
|
39
39
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
40
|
-
import { contextualMenuDropdownWidth } from '../consts';
|
|
40
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
|
|
41
41
|
import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
|
|
42
42
|
import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
|
|
43
43
|
export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
@@ -530,7 +530,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
530
530
|
onMouseEnter: this.handleItemMouseEnter,
|
|
531
531
|
onMouseLeave: this.handleItemMouseLeave,
|
|
532
532
|
fitHeight: 188,
|
|
533
|
-
fitWidth: contextualMenuDropdownWidth,
|
|
533
|
+
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
|
|
534
534
|
boundariesElement: boundariesElement,
|
|
535
535
|
offset: offset,
|
|
536
536
|
section: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') && getBooleanFF('platform.editor.menu.group-items') ? {
|
|
@@ -5,7 +5,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
8
|
-
import { contextualMenuDropdownWidth, contextualMenuTriggerSize } from '../consts';
|
|
8
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize } from '../consts';
|
|
9
9
|
import ContextualMenu from './ContextualMenu';
|
|
10
10
|
import { tablePopupStyles } from './styles';
|
|
11
11
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
@@ -19,7 +19,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
19
19
|
getEditorContainerWidth = _ref.getEditorContainerWidth;
|
|
20
20
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
21
21
|
var _getPluginState = getPluginState(editorView.state),
|
|
22
|
-
targetCellPosition = _getPluginState.targetCellPosition
|
|
22
|
+
targetCellPosition = _getPluginState.targetCellPosition,
|
|
23
|
+
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
23
24
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
@@ -42,7 +43,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
42
43
|
boundariesElement: boundariesElement,
|
|
43
44
|
scrollableElement: scrollableElement,
|
|
44
45
|
fitHeight: 188,
|
|
45
|
-
fitWidth: contextualMenuDropdownWidth
|
|
46
|
+
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth
|
|
46
47
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
47
48
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
48
49
|
,
|
|
@@ -51,7 +52,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
51
52
|
offset: [-7, 0],
|
|
52
53
|
stick: true
|
|
53
54
|
}, jsx("div", {
|
|
54
|
-
css: tablePopupStyles
|
|
55
|
+
css: tablePopupStyles(isDragAndDropEnabled)
|
|
55
56
|
}, jsx(ContextualMenu, {
|
|
56
57
|
editorView: editorView,
|
|
57
58
|
offset: [contextualMenuTriggerSize / 2, -contextualMenuTriggerSize],
|
|
@@ -4,7 +4,7 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
5
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { TableCssClassName as ClassName } from '../../types';
|
|
7
|
-
import { contextualMenuDropdownWidth } from '../consts';
|
|
7
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
|
|
8
8
|
export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
9
9
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
10
10
|
};
|
|
@@ -12,4 +12,6 @@ export var elementBeforeIconStyles = css(_templateObject2 || (_templateObject2 =
|
|
|
12
12
|
|
|
13
13
|
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
14
14
|
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
15
|
-
export var tablePopupStyles =
|
|
15
|
+
export var tablePopupStyles = function tablePopupStyles(isDragAndDropEnabled) {
|
|
16
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 20px;\n height: 20px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 20px;\n color: ", ";\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), ClassName.CONTEXTUAL_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.CONTEXTUAL_MENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"), ClassName.CONTEXTUAL_MENU_ICON_SMALL, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
17
|
+
};
|
|
@@ -97,9 +97,12 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
97
97
|
clearHoverSelection()(state, dispatch);
|
|
98
98
|
}
|
|
99
99
|
}, [editorView, tableActive]);
|
|
100
|
-
var handleMouseUp = useCallback(function () {
|
|
100
|
+
var handleMouseUp = useCallback(function (event) {
|
|
101
101
|
var state = editorView.state,
|
|
102
102
|
dispatch = editorView.dispatch;
|
|
103
|
+
if (event.shiftKey) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
103
106
|
toggleDragMenu(undefined, 'column', colIndex)(state, dispatch);
|
|
104
107
|
}, [editorView, colIndex]);
|
|
105
108
|
var colIndexes = useMemo(function () {
|
|
@@ -154,7 +157,9 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
154
157
|
alignItems: 'center',
|
|
155
158
|
height: 'fit-content',
|
|
156
159
|
placeSelf: 'center',
|
|
157
|
-
zIndex: 99
|
|
160
|
+
zIndex: 99,
|
|
161
|
+
width: '100%',
|
|
162
|
+
position: 'relative'
|
|
158
163
|
},
|
|
159
164
|
"data-column-control-index": hoveredCell.colIndex,
|
|
160
165
|
"data-testid": "table-floating-column-".concat(isSelecting ? selectedColIndexes[0] : colIndex, "-drag-handle")
|
|
@@ -2,19 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
3
3
|
import { ColumnDropTarget } from './ColumnDropTarget';
|
|
4
4
|
export var ColumnDropTargets = function ColumnDropTargets(_ref) {
|
|
5
|
-
var _rowHeights$;
|
|
6
5
|
var tableRef = _ref.tableRef,
|
|
7
6
|
tableHeight = _ref.tableHeight,
|
|
8
|
-
stickyTop = _ref.stickyTop,
|
|
9
7
|
localId = _ref.localId,
|
|
10
|
-
rowHeights = _ref.rowHeights,
|
|
11
8
|
colWidths = _ref.colWidths;
|
|
12
9
|
if (!tableRef) {
|
|
13
10
|
return null;
|
|
14
11
|
}
|
|
15
|
-
var firstRow = tableRef.querySelector('tr');
|
|
16
|
-
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
17
|
-
var marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
|
|
18
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
13
|
className: ClassName.DRAG_COLUMN_DROP_TARGET_CONTROLS,
|
|
20
14
|
contentEditable: false
|
|
@@ -28,7 +22,7 @@ export var ColumnDropTargets = function ColumnDropTargets(_ref) {
|
|
|
28
22
|
localId: localId,
|
|
29
23
|
width: width,
|
|
30
24
|
height: tableHeight,
|
|
31
|
-
marginTop:
|
|
25
|
+
marginTop: 0
|
|
32
26
|
});
|
|
33
27
|
})));
|
|
34
28
|
};
|
|
@@ -131,10 +131,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
131
131
|
isDragging: isDragging
|
|
132
132
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
133
133
|
tableRef: tableRef,
|
|
134
|
-
stickyTop: tableActive ? stickyTop : undefined,
|
|
135
134
|
tableHeight: tableRect.height,
|
|
136
135
|
localId: currentNodeLocalId,
|
|
137
|
-
rowHeights: rowHeights,
|
|
138
136
|
colWidths: colWidths
|
|
139
137
|
}));
|
|
140
138
|
};
|
|
@@ -76,7 +76,10 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}, [editorView]);
|
|
79
|
-
var onMouseUp = useCallback(function () {
|
|
79
|
+
var onMouseUp = useCallback(function (event) {
|
|
80
|
+
if (event.shiftKey) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
80
83
|
toggleDragMenu(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex)(editorView.state, editorView.dispatch);
|
|
81
84
|
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex]);
|
|
82
85
|
var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
@@ -136,7 +139,9 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
136
139
|
gridRow: isSelecting ? selectedRowPosition : gridRowPosition,
|
|
137
140
|
gridColumn: '2',
|
|
138
141
|
// DragHandle uses `transform: rotate(90)`, which doesn't affect its parent (this div) causing the width of this element to be the true height of the drag handle
|
|
142
|
+
display: 'flex',
|
|
139
143
|
width: '9px',
|
|
144
|
+
height: '100%',
|
|
140
145
|
position: 'relative',
|
|
141
146
|
right: '-0.5px'
|
|
142
147
|
},
|