@atlaskit/editor-plugin-table 5.4.19 → 5.4.21
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/index.js +1 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -2
- package/dist/cjs/plugins/table/nodeviews/table.js +7 -2
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +2 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/consts.js +3 -2
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +38 -14
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/cjs/plugins/table/ui/DragHandle/HandleIconComponent.js +4 -2
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +7 -4
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +4 -2
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -3
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +4 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +10 -8
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +7 -4
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/utils/drag-menu.js +10 -6
- package/dist/es2019/plugins/table/index.js +1 -0
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -2
- package/dist/es2019/plugins/table/nodeviews/table.js +7 -2
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/consts.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +39 -15
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +5 -0
- package/dist/es2019/plugins/table/ui/DragHandle/HandleIconComponent.js +3 -1
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +6 -4
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +4 -2
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -3
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +4 -2
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +10 -8
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +7 -4
- package/dist/es2019/plugins/table/ui/common-styles.js +1 -2
- package/dist/es2019/plugins/table/utils/drag-menu.js +6 -6
- package/dist/esm/plugins/table/index.js +1 -0
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -2
- package/dist/esm/plugins/table/nodeviews/table.js +7 -2
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/consts.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +39 -15
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/esm/plugins/table/ui/DragHandle/HandleIconComponent.js +4 -2
- package/dist/esm/plugins/table/ui/DragHandle/index.js +7 -4
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +4 -2
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -3
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +4 -2
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +10 -8
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +7 -4
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/drag-menu.js +10 -6
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +4 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +1 -0
- package/dist/types/plugins/table/ui/DragHandle/HandleIconComponent.d.ts +1 -0
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingDragMenu/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/index.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +1 -0
- package/dist/types/plugins/table/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +4 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/HandleIconComponent.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/drag-menu.d.ts +1 -1
- package/package.json +1 -1
- package/src/__tests__/unit/pm-plugins/drag-and-drop/plugin.ts +112 -0
- package/src/plugins/table/index.tsx +1 -0
- package/src/plugins/table/nodeviews/TableComponent.tsx +4 -0
- package/src/plugins/table/nodeviews/table.tsx +4 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +9 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/consts.ts +2 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +49 -17
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +5 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +1 -0
- package/src/plugins/table/ui/DragHandle/HandleIconComponent.tsx +5 -1
- package/src/plugins/table/ui/DragHandle/index.tsx +6 -2
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +3 -1
- package/src/plugins/table/ui/FloatingDragMenu/index.tsx +3 -0
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +5 -1
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +3 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +11 -8
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +6 -1
- package/src/plugins/table/ui/common-styles.ts +1 -2
- package/src/plugins/table/utils/drag-menu.ts +6 -6
|
@@ -99,9 +99,10 @@ export default class TableFloatingControls extends Component {
|
|
|
99
99
|
headerRowHeight,
|
|
100
100
|
stickyHeader,
|
|
101
101
|
hoveredCell,
|
|
102
|
-
isTableHovered
|
|
102
|
+
isTableHovered,
|
|
103
|
+
canDrag
|
|
103
104
|
} = this.props;
|
|
104
|
-
return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered;
|
|
105
|
+
return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered || canDrag !== nextProps.canDrag;
|
|
105
106
|
}
|
|
106
107
|
componentWillUnmount() {
|
|
107
108
|
if (this.resizeObserver) {
|
|
@@ -124,7 +125,8 @@ export default class TableFloatingControls extends Component {
|
|
|
124
125
|
stickyHeader,
|
|
125
126
|
isDragAndDropEnabled,
|
|
126
127
|
hoveredCell,
|
|
127
|
-
isTableHovered
|
|
128
|
+
isTableHovered,
|
|
129
|
+
canDrag
|
|
128
130
|
} = this.props;
|
|
129
131
|
if (!tableRef) {
|
|
130
132
|
return null;
|
|
@@ -165,7 +167,8 @@ export default class TableFloatingControls extends Component {
|
|
|
165
167
|
tableWidth: this.state.tableWrapperWidth,
|
|
166
168
|
hoverRows: this.hoverRows,
|
|
167
169
|
selectRow: this.selectRow,
|
|
168
|
-
updateCellHoverLocation: this.updateCellHoverLocation
|
|
170
|
+
updateCellHoverLocation: this.updateCellHoverLocation,
|
|
171
|
+
canDrag: canDrag
|
|
169
172
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
170
173
|
editorView: editorView,
|
|
171
174
|
tableRef: tableRef,
|
|
@@ -614,10 +614,9 @@ export const tableStyles = props => {
|
|
|
614
614
|
z-index: ${akEditorUnitZIndex};
|
|
615
615
|
|
|
616
616
|
.${ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER} {
|
|
617
|
+
position: relative;
|
|
617
618
|
align-self: end;
|
|
618
|
-
position: absolute;
|
|
619
619
|
height: 100%;
|
|
620
|
-
width: 24px;
|
|
621
620
|
}
|
|
622
621
|
|
|
623
622
|
.${ClassName.DRAG_ROW_FLOATING_INSERT_DOT} {
|
|
@@ -16,7 +16,7 @@ import { deleteRows } from '../transforms';
|
|
|
16
16
|
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
17
17
|
const canDecrease = (index, min = 0) => index !== undefined && index > min;
|
|
18
18
|
const canIncrease = (index, max = 0) => index !== undefined && index < max;
|
|
19
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth,
|
|
19
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, tableMap, index, targetCellPosition, selectionRect) => {
|
|
20
20
|
const addOptions = direction === 'row' ? [{
|
|
21
21
|
label: 'above',
|
|
22
22
|
offset: 0,
|
|
@@ -41,27 +41,27 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
41
41
|
const moveOptions = direction === 'row' ? [{
|
|
42
42
|
label: 'up',
|
|
43
43
|
offset: -1,
|
|
44
|
-
canMove: canDecrease,
|
|
44
|
+
canMove: index => canDrag && canDecrease(index),
|
|
45
45
|
icon: ArrowUpIcon
|
|
46
46
|
}, {
|
|
47
47
|
label: 'down',
|
|
48
48
|
offset: 1,
|
|
49
49
|
canMove: index => {
|
|
50
50
|
var _tableMap$height;
|
|
51
|
-
return canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
51
|
+
return canDrag && canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
52
52
|
},
|
|
53
53
|
icon: ArrowDownIcon
|
|
54
54
|
}] : [{
|
|
55
55
|
label: 'left',
|
|
56
56
|
offset: -1,
|
|
57
|
-
canMove: canDecrease,
|
|
57
|
+
canMove: index => canDrag && canDecrease(index),
|
|
58
58
|
icon: ArrowLeftIcon
|
|
59
59
|
}, {
|
|
60
60
|
label: 'right',
|
|
61
61
|
offset: 1,
|
|
62
62
|
canMove: index => {
|
|
63
63
|
var _tableMap$width;
|
|
64
|
-
return canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
64
|
+
return canDrag && canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
65
65
|
},
|
|
66
66
|
icon: ArrowRightIcon
|
|
67
67
|
}];
|
|
@@ -129,7 +129,7 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
129
129
|
}) => ({
|
|
130
130
|
id: `move_${direction}_${label}`,
|
|
131
131
|
title: `Move ${direction} ${label}`,
|
|
132
|
-
disabled:
|
|
132
|
+
disabled: !canMove(index),
|
|
133
133
|
icon,
|
|
134
134
|
onClick: (state, dispatch) => {
|
|
135
135
|
if (canMove(index)) {
|
|
@@ -345,6 +345,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
345
345
|
direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
|
|
346
346
|
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
347
347
|
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
348
|
+
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
348
349
|
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
349
350
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
350
351
|
editorView: editorView,
|
|
@@ -511,7 +511,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
511
511
|
options = _this$props10.options,
|
|
512
512
|
getPos = _this$props10.getPos,
|
|
513
513
|
pluginInjectionApi = _this$props10.pluginInjectionApi,
|
|
514
|
-
isDragAndDropEnabled = _this$props10.isDragAndDropEnabled
|
|
514
|
+
isDragAndDropEnabled = _this$props10.isDragAndDropEnabled,
|
|
515
|
+
canDrag = _this$props10.canDrag;
|
|
515
516
|
var _this$state3 = this.state,
|
|
516
517
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
517
518
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
@@ -538,6 +539,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
538
539
|
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
|
|
539
540
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
540
541
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
542
|
+
canDrag: canDrag,
|
|
541
543
|
ordering: ordering,
|
|
542
544
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
543
545
|
hasHeaderRow: hasHeaderRow
|
|
@@ -564,7 +566,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
564
566
|
selection: view.state.selection,
|
|
565
567
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
566
568
|
stickyHeader: this.state.stickyHeader,
|
|
567
|
-
getEditorFeatureFlags: this.props.getEditorFeatureFlags
|
|
569
|
+
getEditorFeatureFlags: this.props.getEditorFeatureFlags,
|
|
570
|
+
canDrag: canDrag
|
|
568
571
|
}) : null;
|
|
569
572
|
var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
|
|
570
573
|
var shadowStyle = memoizeOne(function (visible) {
|
|
@@ -18,6 +18,7 @@ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
|
18
18
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
20
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
21
|
+
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
|
|
21
22
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
22
23
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
23
24
|
import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing';
|
|
@@ -135,14 +136,17 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
135
136
|
tableResizingPluginState: tableResizingPluginKey,
|
|
136
137
|
tableWidthPluginState: tableWidthPluginKey,
|
|
137
138
|
widthPlugin: fakePluginKey,
|
|
138
|
-
mediaState: fakeMediaPluginKey
|
|
139
|
+
mediaState: fakeMediaPluginKey,
|
|
140
|
+
tableDragAndDropState: tableDragAndDropPluginKey
|
|
139
141
|
},
|
|
140
142
|
editorView: props.view,
|
|
141
143
|
render: function render(pluginStates) {
|
|
144
|
+
var _tableDragAndDropStat;
|
|
142
145
|
var tableResizingPluginState = pluginStates.tableResizingPluginState,
|
|
143
146
|
tableWidthPluginState = pluginStates.tableWidthPluginState,
|
|
144
147
|
pluginState = pluginStates.pluginState,
|
|
145
|
-
mediaState = pluginStates.mediaState
|
|
148
|
+
mediaState = pluginStates.mediaState,
|
|
149
|
+
tableDragAndDropState = pluginStates.tableDragAndDropState;
|
|
146
150
|
var containerWidth = props.getEditorContainerWidth();
|
|
147
151
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
148
152
|
var isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
|
|
@@ -170,6 +174,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
170
174
|
isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
|
|
171
175
|
isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
|
|
172
176
|
isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
|
|
177
|
+
canDrag: (_tableDragAndDropStat = tableDragAndDropState === null || tableDragAndDropState === void 0 ? void 0 : tableDragAndDropState.canDrag) !== null && _tableDragAndDropStat !== void 0 ? _tableDragAndDropStat : false,
|
|
173
178
|
tableActive: tableActive,
|
|
174
179
|
ordering: pluginState.ordering,
|
|
175
180
|
isResizing: isResizing,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export var DragAndDropActionType = {
|
|
2
2
|
SET_DROP_TARGET: 'SET_DROP_TARGET',
|
|
3
3
|
CLEAR_DROP_TARGET: 'CLEAR_DROP_TARGET',
|
|
4
|
-
TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU'
|
|
4
|
+
TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU',
|
|
5
|
+
UPDATE: 'UPDATE'
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
// NOTE: This should be a Union of all possible actions
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
7
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -10,7 +13,7 @@ import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
|
10
13
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
11
14
|
import { DragAndDropActionType } from './actions';
|
|
12
15
|
import { clearDropTarget, moveSource, setDropTarget, toggleDragMenu } from './commands';
|
|
13
|
-
import { DropTargetType } from './consts';
|
|
16
|
+
import { DRAGGABLE_TABLE_NODE_SIZE_LIMIT, DropTargetType } from './consts';
|
|
14
17
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
15
18
|
import { pluginKey } from './plugin-key';
|
|
16
19
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
@@ -23,18 +26,24 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
23
26
|
dropTargetIndex: 0,
|
|
24
27
|
isDragMenuOpen: false,
|
|
25
28
|
dragMenuIndex: 0,
|
|
26
|
-
isDragging: false
|
|
29
|
+
isDragging: false,
|
|
30
|
+
canDrag: false
|
|
27
31
|
};
|
|
28
32
|
}),
|
|
29
33
|
key: pluginKey,
|
|
30
34
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
31
35
|
var _getTablePluginState = getTablePluginState(oldState),
|
|
32
|
-
oldTargetCellPosition = _getTablePluginState.targetCellPosition
|
|
36
|
+
oldTargetCellPosition = _getTablePluginState.targetCellPosition,
|
|
37
|
+
oldTableNode = _getTablePluginState.tableNode;
|
|
33
38
|
var _getTablePluginState2 = getTablePluginState(newState),
|
|
34
|
-
newTargetCellPosition = _getTablePluginState2.targetCellPosition
|
|
39
|
+
newTargetCellPosition = _getTablePluginState2.targetCellPosition,
|
|
40
|
+
newTableNode = _getTablePluginState2.tableNode;
|
|
35
41
|
var _getPluginState = getPluginState(newState),
|
|
36
42
|
isDragMenuOpen = _getPluginState.isDragMenuOpen,
|
|
37
|
-
dragMenuIndex = _getPluginState.dragMenuIndex
|
|
43
|
+
dragMenuIndex = _getPluginState.dragMenuIndex,
|
|
44
|
+
canDrag = _getPluginState.canDrag;
|
|
45
|
+
var stateChanges = [];
|
|
46
|
+
var tr = newState.tr;
|
|
38
47
|
|
|
39
48
|
// What's happening here? you asked... In a nutshell;
|
|
40
49
|
// If the target cell position changes while the drag menu is open then we want to close the drag menu if it has been opened.
|
|
@@ -42,14 +51,6 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
42
51
|
// to check if the new target cell position is pointed at a different cell than what the drag menu was opened on.
|
|
43
52
|
if (oldTargetCellPosition !== newTargetCellPosition) {
|
|
44
53
|
if (isDragMenuOpen) {
|
|
45
|
-
var tr = newState.tr;
|
|
46
|
-
var action = {
|
|
47
|
-
type: DragAndDropActionType.TOGGLE_DRAG_MENU,
|
|
48
|
-
data: {
|
|
49
|
-
isDragMenuOpen: false,
|
|
50
|
-
direction: undefined
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
54
|
if (newTargetCellPosition !== undefined) {
|
|
54
55
|
var cells = getCellsInRow(dragMenuIndex)(tr.selection);
|
|
55
56
|
// ED-20673 check if it is a cell selection,
|
|
@@ -57,13 +58,36 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
|
57
58
|
// should not close the drag menu.
|
|
58
59
|
var isCellSelection = tr.selection instanceof CellSelection;
|
|
59
60
|
if (cells && cells.length && cells[0].node !== tr.doc.nodeAt(newTargetCellPosition) && !isCellSelection) {
|
|
60
|
-
|
|
61
|
+
stateChanges.push({
|
|
62
|
+
isDragMenuOpen: false,
|
|
63
|
+
dragMenuDirection: undefined
|
|
64
|
+
});
|
|
61
65
|
} // else NOP
|
|
62
66
|
} else {
|
|
63
|
-
|
|
67
|
+
stateChanges.push({
|
|
68
|
+
isDragMenuOpen: false,
|
|
69
|
+
dragMenuDirection: undefined
|
|
70
|
+
});
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
}
|
|
74
|
+
if ((oldTableNode === null || oldTableNode === void 0 ? void 0 : oldTableNode.nodeSize) !== (newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize)) {
|
|
75
|
+
var _newTableNode$nodeSiz;
|
|
76
|
+
var nextCanDrag = ((_newTableNode$nodeSiz = newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize) !== null && _newTableNode$nodeSiz !== void 0 ? _newTableNode$nodeSiz : 0) < DRAGGABLE_TABLE_NODE_SIZE_LIMIT;
|
|
77
|
+
if (canDrag !== nextCanDrag) {
|
|
78
|
+
stateChanges.push({
|
|
79
|
+
canDrag: nextCanDrag
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (stateChanges.length) {
|
|
84
|
+
return tr.setMeta(pluginKey, {
|
|
85
|
+
type: DragAndDropActionType.UPDATE,
|
|
86
|
+
data: _objectSpread({}, stateChanges.reduce(function (state, cur) {
|
|
87
|
+
return _objectSpread(_objectSpread({}, state), cur);
|
|
88
|
+
}, {}))
|
|
89
|
+
}).setMeta('addToHistory', false);
|
|
90
|
+
}
|
|
67
91
|
},
|
|
68
92
|
view: function view(editorView) {
|
|
69
93
|
return {
|
|
@@ -25,6 +25,8 @@ export default (function (pluginState, action) {
|
|
|
25
25
|
dragMenuDirection: action.data.direction,
|
|
26
26
|
dragMenuIndex: action.data.index
|
|
27
27
|
});
|
|
28
|
+
case DragAndDropActionType.UPDATE:
|
|
29
|
+
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
28
30
|
default:
|
|
29
31
|
return pluginState;
|
|
30
32
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DragHandleDisabledIcon, DragHandleIcon, MinimisedHandleIcon } from '../icons';
|
|
3
3
|
export var HandleIconComponent = function HandleIconComponent(props) {
|
|
4
|
-
var
|
|
4
|
+
var canDrag = props.canDrag,
|
|
5
|
+
direction = props.direction,
|
|
5
6
|
isDragMenuOpen = props.isDragMenuOpen,
|
|
6
7
|
isRowHandleHovered = props.isRowHandleHovered,
|
|
7
8
|
isColumnHandleHovered = props.isColumnHandleHovered,
|
|
@@ -12,7 +13,8 @@ export var HandleIconComponent = function HandleIconComponent(props) {
|
|
|
12
13
|
var isHandleHovered = isRowHandleHovered || isColumnHandleHovered;
|
|
13
14
|
var isCurrentRowOrColumnSelected = isCurrentRowSelected || isCurrentColumnSelected;
|
|
14
15
|
var isDragMenuOpenOnCurrentRowOrColumn = isDragMenuOpen && dragMenuDirection === direction && isCurrentRowOrColumnSelected;
|
|
15
|
-
var
|
|
16
|
+
var isDragPossible = canDrag && !hasMergedCells;
|
|
17
|
+
var showNormalHandle = !isDragPossible ? /*#__PURE__*/React.createElement(DragHandleDisabledIcon, null) : /*#__PURE__*/React.createElement(DragHandleIcon, null);
|
|
16
18
|
|
|
17
19
|
// hoverred handle or open drag menu
|
|
18
20
|
if (isHandleHovered || isDragMenuOpenOnCurrentRowOrColumn) {
|
|
@@ -25,7 +25,9 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
25
25
|
onMouseOut = _ref.onMouseOut,
|
|
26
26
|
_onMouseUp = _ref.onMouseUp,
|
|
27
27
|
onClick = _ref.onClick,
|
|
28
|
-
editorView = _ref.editorView
|
|
28
|
+
editorView = _ref.editorView,
|
|
29
|
+
_ref$canDrag = _ref.canDrag,
|
|
30
|
+
_canDrag = _ref$canDrag === void 0 ? false : _ref$canDrag;
|
|
29
31
|
var dragHandleDivRef = useRef(null);
|
|
30
32
|
var _useState = useState(null),
|
|
31
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -48,6 +50,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
48
50
|
return direction === 'row' ? hasMergedCellsInRow(indexes[0])(selection) : hasMergedCellsInColumn(indexes[0])(selection);
|
|
49
51
|
}, [indexes, direction, selection]);
|
|
50
52
|
var handleIconProps = {
|
|
53
|
+
canDrag: _canDrag,
|
|
51
54
|
hasMergedCells: hasMergedCells,
|
|
52
55
|
direction: direction,
|
|
53
56
|
isDragMenuOpen: isDragMenuOpen,
|
|
@@ -63,7 +66,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
63
66
|
return draggable({
|
|
64
67
|
element: dragHandleDivRefCurrent,
|
|
65
68
|
canDrag: function canDrag() {
|
|
66
|
-
return !hasMergedCells;
|
|
69
|
+
return _canDrag && !hasMergedCells;
|
|
67
70
|
},
|
|
68
71
|
getInitialData: function getInitialData() {
|
|
69
72
|
return {
|
|
@@ -111,9 +114,9 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
111
114
|
}
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
|
-
}, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells]);
|
|
117
|
+
}, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells, _canDrag]);
|
|
115
118
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
116
|
-
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, hasMergedCells)),
|
|
119
|
+
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, !_canDrag || hasMergedCells)),
|
|
117
120
|
ref: dragHandleDivRef,
|
|
118
121
|
style: {
|
|
119
122
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)'
|
|
@@ -67,7 +67,8 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
67
67
|
boundariesElement = _ref.boundariesElement,
|
|
68
68
|
scrollableElement = _ref.scrollableElement,
|
|
69
69
|
targetCellPosition = _ref.targetCellPosition,
|
|
70
|
-
getEditorContainerWidth = _ref.getEditorContainerWidth
|
|
70
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
71
|
+
canDrag = _ref.canDrag;
|
|
71
72
|
var tableMap = tableNode ? TableMap.get(tableNode) : undefined;
|
|
72
73
|
var state = editorView.state,
|
|
73
74
|
dispatch = editorView.dispatch;
|
|
@@ -75,7 +76,7 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
75
76
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
76
77
|
var hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
|
|
77
78
|
var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
78
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, shouldMoveDisabled, tableMap, index, targetCellPosition, selectionRect);
|
|
79
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, tableMap, index, targetCellPosition, selectionRect);
|
|
79
80
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig),
|
|
80
81
|
menuItems = _convertToDropdownIte.menuItems,
|
|
81
82
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -16,7 +16,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
16
16
|
direction = _ref.direction,
|
|
17
17
|
index = _ref.index,
|
|
18
18
|
targetCellPosition = _ref.targetCellPosition,
|
|
19
|
-
getEditorContainerWidth = _ref.getEditorContainerWidth
|
|
19
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
20
|
+
canDrag = _ref.canDrag;
|
|
20
21
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
@@ -51,7 +52,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
51
52
|
direction: direction,
|
|
52
53
|
index: index,
|
|
53
54
|
targetCellPosition: targetCellPosition,
|
|
54
|
-
getEditorContainerWidth: getEditorContainerWidth
|
|
55
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
56
|
+
canDrag: canDrag
|
|
55
57
|
}));
|
|
56
58
|
};
|
|
57
59
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
3
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
3
4
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
5
|
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn } from '../../../commands';
|
|
@@ -29,7 +30,8 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
29
30
|
rowHeights = _ref.rowHeights,
|
|
30
31
|
colWidths = _ref.colWidths,
|
|
31
32
|
hasHeaderColumn = _ref.hasHeaderColumn,
|
|
32
|
-
isTableHovered = _ref.isTableHovered
|
|
33
|
+
isTableHovered = _ref.isTableHovered,
|
|
34
|
+
canDrag = _ref.canDrag;
|
|
33
35
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
34
36
|
return width ? "".concat(width - 1, "px") : '0px';
|
|
35
37
|
}).join(' ')) !== null && _colWidths$map$join !== void 0 ? _colWidths$map$join : '0px';
|
|
@@ -139,14 +141,15 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
139
141
|
direction: "column",
|
|
140
142
|
tableLocalId: localId || '',
|
|
141
143
|
indexes: colIndexes,
|
|
142
|
-
previewWidth: (_colWidths = colWidths === null || colWidths === void 0 ? void 0 : colWidths[colIndex]) !== null && _colWidths !== void 0 ? _colWidths :
|
|
144
|
+
previewWidth: (_colWidths = colWidths === null || colWidths === void 0 ? void 0 : colWidths[colIndex]) !== null && _colWidths !== void 0 ? _colWidths : tableCellMinWidth,
|
|
143
145
|
previewHeight: previewHeight,
|
|
144
146
|
appearance: selectedColIndexes.includes(hoveredCell.colIndex) ? isInDanger ? 'danger' : 'selected' : 'default',
|
|
145
147
|
onClick: handleClick,
|
|
146
148
|
onMouseOver: handleMouseOver,
|
|
147
149
|
onMouseOut: handleMouseOut,
|
|
148
150
|
onMouseUp: handleMouseUp,
|
|
149
|
-
editorView: editorView
|
|
151
|
+
editorView: editorView,
|
|
152
|
+
canDrag: canDrag
|
|
150
153
|
}))));
|
|
151
154
|
};
|
|
152
155
|
export default ColumnControls;
|
|
@@ -19,7 +19,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
19
19
|
stickyHeader = _ref.stickyHeader,
|
|
20
20
|
selection = _ref.selection,
|
|
21
21
|
isInDanger = _ref.isInDanger,
|
|
22
|
-
isTableHovered = _ref.isTableHovered
|
|
22
|
+
isTableHovered = _ref.isTableHovered,
|
|
23
|
+
canDrag = _ref.canDrag;
|
|
23
24
|
var _useState = useState({
|
|
24
25
|
width: 0,
|
|
25
26
|
height: 0
|
|
@@ -110,7 +111,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
110
111
|
isInDanger: isInDanger,
|
|
111
112
|
rowHeights: rowHeights,
|
|
112
113
|
colWidths: colWidths,
|
|
113
|
-
hasHeaderColumn: hasHeaderColumn
|
|
114
|
+
hasHeaderColumn: hasHeaderColumn,
|
|
115
|
+
canDrag: canDrag
|
|
114
116
|
}), hasDropTargets && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
115
117
|
tableRef: tableRef,
|
|
116
118
|
stickyTop: tableActive ? stickyTop : undefined,
|
|
@@ -33,6 +33,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
33
33
|
isInDanger = _ref.isInDanger,
|
|
34
34
|
isResizing = _ref.isResizing,
|
|
35
35
|
isTableHovered = _ref.isTableHovered,
|
|
36
|
+
canDrag = _ref.canDrag,
|
|
36
37
|
hoverRows = _ref.hoverRows,
|
|
37
38
|
selectRow = _ref.selectRow,
|
|
38
39
|
updateCellHoverLocation = _ref.updateCellHoverLocation;
|
|
@@ -113,7 +114,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
113
114
|
className: ClassName.DRAG_ROW_CONTROLS,
|
|
114
115
|
style: {
|
|
115
116
|
gridTemplateRows: heights,
|
|
116
|
-
gridTemplateColumns: isDragging ? "".concat(dropTargetExtendedWidth, "px
|
|
117
|
+
gridTemplateColumns: isDragging ? "".concat(dropTargetExtendedWidth, "px 14px ").concat(tableWidth, "px") : '0px 14px 0px',
|
|
117
118
|
left: isDragging ? "-".concat(dropTargetExtendedWidth + 2, "px") : "-2px"
|
|
118
119
|
},
|
|
119
120
|
onMouseMove: handleMouseMove,
|
|
@@ -132,11 +133,11 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
132
133
|
"data-end-index": endIndex,
|
|
133
134
|
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER,
|
|
134
135
|
contentEditable: false,
|
|
135
|
-
key: index
|
|
136
|
+
key: "insert-dot-".concat(index)
|
|
136
137
|
}, /*#__PURE__*/React.createElement("div", {
|
|
137
138
|
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
|
|
138
139
|
})), isDragging && /*#__PURE__*/React.createElement(RowDropTarget, {
|
|
139
|
-
key: index,
|
|
140
|
+
key: "drop-target-".concat(index),
|
|
140
141
|
index: index,
|
|
141
142
|
localId: currentNodeLocalId,
|
|
142
143
|
style: {
|
|
@@ -152,10 +153,10 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
152
153
|
style: {
|
|
153
154
|
gridRow: gridRowPosition,
|
|
154
155
|
gridColumn: '2',
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
// 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
|
|
157
|
+
width: '9px',
|
|
158
|
+
position: 'relative',
|
|
159
|
+
right: '-0.5px'
|
|
159
160
|
},
|
|
160
161
|
"data-testid": "table-floating-row-drag-handle"
|
|
161
162
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
@@ -168,7 +169,8 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
168
169
|
onMouseOver: handleMouseOver,
|
|
169
170
|
onMouseOut: handleMouseOut,
|
|
170
171
|
onMouseUp: onMouseUp,
|
|
171
|
-
editorView: editorView
|
|
172
|
+
editorView: editorView,
|
|
173
|
+
canDrag: canDrag
|
|
172
174
|
})));
|
|
173
175
|
};
|
|
174
176
|
export var DragControls = injectIntl(DragControlsComponent);
|
|
@@ -126,8 +126,9 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
126
126
|
headerRowHeight = _this$props2.headerRowHeight,
|
|
127
127
|
stickyHeader = _this$props2.stickyHeader,
|
|
128
128
|
hoveredCell = _this$props2.hoveredCell,
|
|
129
|
-
isTableHovered = _this$props2.isTableHovered
|
|
130
|
-
|
|
129
|
+
isTableHovered = _this$props2.isTableHovered,
|
|
130
|
+
canDrag = _this$props2.canDrag;
|
|
131
|
+
return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered || canDrag !== nextProps.canDrag;
|
|
131
132
|
}
|
|
132
133
|
}, {
|
|
133
134
|
key: "componentWillUnmount",
|
|
@@ -154,7 +155,8 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
154
155
|
stickyHeader = _this$props3.stickyHeader,
|
|
155
156
|
isDragAndDropEnabled = _this$props3.isDragAndDropEnabled,
|
|
156
157
|
hoveredCell = _this$props3.hoveredCell,
|
|
157
|
-
isTableHovered = _this$props3.isTableHovered
|
|
158
|
+
isTableHovered = _this$props3.isTableHovered,
|
|
159
|
+
canDrag = _this$props3.canDrag;
|
|
158
160
|
if (!tableRef) {
|
|
159
161
|
return null;
|
|
160
162
|
}
|
|
@@ -196,7 +198,8 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
196
198
|
tableWidth: this.state.tableWrapperWidth,
|
|
197
199
|
hoverRows: this.hoverRows,
|
|
198
200
|
selectRow: this.selectRow,
|
|
199
|
-
updateCellHoverLocation: this.updateCellHoverLocation
|
|
201
|
+
updateCellHoverLocation: this.updateCellHoverLocation,
|
|
202
|
+
canDrag: canDrag
|
|
200
203
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
201
204
|
editorView: editorView,
|
|
202
205
|
tableRef: tableRef,
|