@atlaskit/editor-plugin-table 5.3.9 → 5.3.11
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/commands/hover.js +4 -2
- package/dist/cjs/plugins/table/event-handlers.js +7 -4
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +3 -2
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +11 -25
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +59 -22
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +15 -27
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +68 -18
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +47 -29
- package/dist/cjs/plugins/table/ui/common-styles.js +2 -2
- package/dist/cjs/plugins/table/ui/icons/DragHandleIcon.js +11 -52
- package/dist/es2019/plugins/table/commands/hover.js +4 -2
- package/dist/es2019/plugins/table/event-handlers.js +7 -4
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +3 -2
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +10 -24
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +61 -18
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +4 -20
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +69 -17
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +24 -2
- package/dist/es2019/plugins/table/ui/common-styles.js +64 -4
- package/dist/es2019/plugins/table/ui/icons/DragHandleIcon.js +11 -52
- package/dist/esm/plugins/table/commands/hover.js +4 -2
- package/dist/esm/plugins/table/event-handlers.js +7 -4
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +3 -2
- package/dist/esm/plugins/table/ui/DragHandle/index.js +11 -25
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +56 -21
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +16 -28
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +67 -19
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +48 -30
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/icons/DragHandleIcon.js +11 -51
- package/dist/types/plugins/table/commands/hover.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +8 -4
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +3 -3
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +6 -5
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/index.d.ts +3 -2
- package/dist/types/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +6 -4
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
- package/dist/types/plugins/table/ui/icons/DragHandleIcon.d.ts +1 -6
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +8 -4
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +6 -5
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +6 -4
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/ui/icons/DragHandleIcon.d.ts +1 -6
- package/package.json +1 -1
- package/src/__tests__/unit/event-handlers.ts +4 -1
- package/src/__tests__/unit/ui/NumberColumn.tsx +5 -8
- package/src/__tests__/unit/ui/RowDragControls.tsx +6 -0
- package/src/plugins/table/commands/hover.ts +7 -2
- package/src/plugins/table/event-handlers.ts +18 -4
- package/src/plugins/table/nodeviews/TableComponent.tsx +3 -2
- package/src/plugins/table/types.ts +13 -4
- package/src/plugins/table/ui/DragHandle/index.tsx +10 -26
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +90 -39
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +5 -2
- package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +10 -15
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +97 -28
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +19 -3
- package/src/plugins/table/ui/common-styles.ts +67 -4
- package/src/plugins/table/ui/icons/DragHandleIcon.tsx +5 -69
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.3.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41823](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41823) [`60dab8657e1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/60dab8657e1) - Add row and column select functionality for table drag controls
|
|
8
|
+
|
|
9
|
+
## 5.3.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42000](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42000) [`62e03b45cf6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62e03b45cf6) - Updated the column drag handle to display the drag preview correctly
|
|
14
|
+
|
|
3
15
|
## 5.3.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -138,14 +138,16 @@ var hideResizeHandleLine = exports.hideResizeHandleLine = function hideResizeHan
|
|
|
138
138
|
};
|
|
139
139
|
});
|
|
140
140
|
};
|
|
141
|
-
var hoverCell = exports.hoverCell = function hoverCell(rowIndex, colIndex) {
|
|
141
|
+
var hoverCell = exports.hoverCell = function hoverCell(rowIndex, colIndex, colWidth, colHeight) {
|
|
142
142
|
return (0, _pluginFactory.createCommand)(function () {
|
|
143
143
|
return {
|
|
144
144
|
type: 'HOVER_CELL',
|
|
145
145
|
data: {
|
|
146
146
|
hoveredCell: {
|
|
147
147
|
rowIndex: rowIndex,
|
|
148
|
-
colIndex: colIndex
|
|
148
|
+
colIndex: colIndex,
|
|
149
|
+
colWidth: colWidth,
|
|
150
|
+
colHeight: colHeight
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
};
|
|
@@ -180,7 +180,7 @@ var handleMouseLeave = exports.handleMouseLeave = function handleMouseLeave(view
|
|
|
180
180
|
return true;
|
|
181
181
|
}
|
|
182
182
|
if (isDragAndDropEnabled) {
|
|
183
|
-
(0, _commands.hoverCell)(
|
|
183
|
+
(0, _commands.hoverCell)()(state, dispatch);
|
|
184
184
|
}
|
|
185
185
|
if ((typeof insertColumnButtonIndex !== 'undefined' || typeof insertRowButtonIndex !== 'undefined') && (0, _commands.hideInsertColumnOrRowButton)()(state, dispatch)) {
|
|
186
186
|
return true;
|
|
@@ -326,7 +326,8 @@ var whenTableInFocus = exports.whenTableInFocus = function whenTableInFocus(even
|
|
|
326
326
|
var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
327
327
|
var target = mouseEvent.target;
|
|
328
328
|
var maybeTableCell = (0, _utils.isElementInTableCell)(target);
|
|
329
|
-
|
|
329
|
+
var tableRef = (0, _pluginFactory.getPluginState)(view.state).tableRef;
|
|
330
|
+
if (!maybeTableCell || !tableRef) {
|
|
330
331
|
return;
|
|
331
332
|
}
|
|
332
333
|
var colIndex = maybeTableCell.cellIndex;
|
|
@@ -334,8 +335,10 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
|
|
|
334
335
|
var rowIndex = rowElement && rowElement.rowIndex;
|
|
335
336
|
var _getPluginState8 = (0, _pluginFactory.getPluginState)(view.state),
|
|
336
337
|
hoveredCell = _getPluginState8.hoveredCell;
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
var colHeight = tableRef.offsetHeight;
|
|
339
|
+
var colWidth = maybeTableCell.offsetWidth;
|
|
340
|
+
if (hoveredCell.colIndex !== colIndex || hoveredCell.rowIndex !== rowIndex || hoveredCell.colWidth !== colWidth || hoveredCell.colHeight !== colHeight) {
|
|
341
|
+
(0, _commands.hoverCell)(rowIndex, colIndex, colWidth, colHeight)(view.state, view.dispatch);
|
|
339
342
|
}
|
|
340
343
|
};
|
|
341
344
|
var withCellTracking = exports.withCellTracking = function withCellTracking(eventHandler, elementContentRects) {
|
|
@@ -496,11 +496,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
496
496
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
497
497
|
stickyHeader: this.state.stickyHeader
|
|
498
498
|
}));
|
|
499
|
-
var colControls = /*#__PURE__*/_react.default.createElement(_TableFloatingColumnControls.default, {
|
|
499
|
+
var colControls = isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_TableFloatingColumnControls.default, {
|
|
500
500
|
editorView: view,
|
|
501
501
|
tableRef: tableRef,
|
|
502
502
|
getNode: getNode,
|
|
503
503
|
tableActive: tableActive,
|
|
504
|
+
isInDanger: isInDanger,
|
|
504
505
|
hoveredRows: hoveredRows,
|
|
505
506
|
hoveredCell: hoveredCell,
|
|
506
507
|
isResizing: isResizing,
|
|
@@ -512,7 +513,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
512
513
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
513
514
|
stickyHeader: this.state.stickyHeader,
|
|
514
515
|
getEditorFeatureFlags: this.props.getEditorFeatureFlags
|
|
515
|
-
});
|
|
516
|
+
}) : null;
|
|
516
517
|
var shadowPadding = allowControls && tableActive ? -_editorSharedStyles.akEditorTableToolbarSize : _styles.tableMarginSides;
|
|
517
518
|
var shadowStyle = (0, _memoizeOne.default)(function (visible) {
|
|
518
519
|
return {
|
|
@@ -8,42 +8,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.DragHandle = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
12
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
12
13
|
var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
|
|
13
14
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview");
|
|
14
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
15
15
|
var _types = require("../../types");
|
|
16
16
|
var _DragPreview = require("../DragPreview");
|
|
17
17
|
var _icons = require("../icons");
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
var mapStateToProps = function mapStateToProps(state) {
|
|
21
|
-
switch (state) {
|
|
22
|
-
case 'danger':
|
|
23
|
-
case 'disabled':
|
|
24
|
-
case 'selected':
|
|
25
|
-
case 'default':
|
|
26
|
-
default:
|
|
27
|
-
return {
|
|
28
|
-
backgroundColor: "var(--ds-background-accent-gray-subtlest, ".concat(_colors.N200, ")"),
|
|
29
|
-
foregroundColor: "var(--ds-icon-subtle, ".concat(_colors.N700, ")")
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
20
|
var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
34
21
|
var tableLocalId = _ref.tableLocalId,
|
|
35
22
|
_ref$direction = _ref.direction,
|
|
36
23
|
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
|
|
37
|
-
_ref$
|
|
38
|
-
|
|
24
|
+
_ref$appearance = _ref.appearance,
|
|
25
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
39
26
|
indexes = _ref.indexes,
|
|
40
27
|
previewWidth = _ref.previewWidth,
|
|
41
28
|
previewHeight = _ref.previewHeight,
|
|
42
|
-
onClick = _ref.onClick,
|
|
43
29
|
onMouseOver = _ref.onMouseOver,
|
|
44
|
-
onMouseOut = _ref.onMouseOut
|
|
30
|
+
onMouseOut = _ref.onMouseOut,
|
|
31
|
+
onClick = _ref.onClick;
|
|
45
32
|
var dragHandleDivRef = (0, _react.useRef)(null);
|
|
46
|
-
var iconProps = mapStateToProps(state);
|
|
47
33
|
var _useState = (0, _react.useState)(null),
|
|
48
34
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
49
35
|
previewContainer = _useState2[0],
|
|
@@ -92,17 +78,17 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
92
78
|
}
|
|
93
79
|
}, [tableLocalId, direction, indexes]);
|
|
94
80
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
95
|
-
className: _types.TableCssClassName.DRAG_HANDLE_BUTTON_CONTAINER,
|
|
81
|
+
className: (0, _classnames.default)(_types.TableCssClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance),
|
|
96
82
|
ref: dragHandleDivRef,
|
|
97
83
|
style: {
|
|
98
|
-
backgroundColor: "var(--ds-surface, white)",
|
|
99
|
-
borderRadius: '4px',
|
|
100
|
-
border: "2px solid ".concat("var(--ds-surface, white)"),
|
|
101
84
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)',
|
|
102
85
|
pointerEvents: 'auto'
|
|
103
86
|
},
|
|
104
|
-
"data-testid": "table-floating-column-controls-drag-handle"
|
|
105
|
-
|
|
87
|
+
"data-testid": "table-floating-column-controls-drag-handle",
|
|
88
|
+
onMouseOver: onMouseOver,
|
|
89
|
+
onMouseOut: onMouseOut,
|
|
90
|
+
onClick: onClick
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.DragHandleIcon, null), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_DragPreview.DragPreview, {
|
|
106
92
|
direction: direction,
|
|
107
93
|
width: previewWidth,
|
|
108
94
|
height: previewHeight
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ColumnControls = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _editorTables = require("@atlaskit/editor-tables");
|
|
10
|
+
var _utils = require("@atlaskit/editor-tables/utils");
|
|
11
|
+
var _commands = require("../../../commands");
|
|
9
12
|
var _types = require("../../../types");
|
|
13
|
+
var _utils2 = require("../../../utils");
|
|
10
14
|
var _DragHandle = require("../../DragHandle");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
var getSelectedColumns = function getSelectedColumns(selection) {
|
|
18
|
+
if (selection instanceof _editorTables.CellSelection && selection.isColSelection()) {
|
|
19
|
+
var rect = (0, _utils.getSelectionRect)(selection);
|
|
20
|
+
if (!rect) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
return (0, _utils2.getSelectedColumnIndexes)(rect);
|
|
24
|
+
}
|
|
25
|
+
return [];
|
|
26
|
+
};
|
|
11
27
|
var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
12
|
-
var
|
|
28
|
+
var _colWidths$map$join, _rowHeights$;
|
|
13
29
|
var editorView = _ref.editorView,
|
|
14
30
|
tableActive = _ref.tableActive,
|
|
15
31
|
tableRef = _ref.tableRef,
|
|
@@ -17,21 +33,41 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
17
33
|
isResizing = _ref.isResizing,
|
|
18
34
|
stickyTop = _ref.stickyTop,
|
|
19
35
|
localId = _ref.localId,
|
|
36
|
+
isInDanger = _ref.isInDanger,
|
|
20
37
|
rowHeights = _ref.rowHeights,
|
|
21
38
|
colWidths = _ref.colWidths;
|
|
22
|
-
if (!tableRef) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
var firstRow = tableRef.querySelector('tr');
|
|
26
|
-
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
27
|
-
var marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
|
|
28
39
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
29
40
|
return width ? "".concat(width - 1, "px") : '0px';
|
|
30
41
|
}).join(' ')) !== null && _colWidths$map$join !== void 0 ? _colWidths$map$join : '0px';
|
|
31
42
|
var colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
43
|
+
var selectedColIndexes = getSelectedColumns(editorView.state.selection);
|
|
44
|
+
var gridColumnPosition = (0, _react.useMemo)(function () {
|
|
45
|
+
// if more than one row is selected, ensure the handle spans over the selected range
|
|
46
|
+
if (selectedColIndexes.includes(colIndex)) {
|
|
47
|
+
return "".concat(selectedColIndexes[0] + 1, " / span ").concat(selectedColIndexes.length);
|
|
48
|
+
}
|
|
49
|
+
return "".concat(colIndex + 1, " / span 1");
|
|
50
|
+
}, [colIndex, selectedColIndexes]);
|
|
51
|
+
var firstRow = tableRef.querySelector('tr');
|
|
52
|
+
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
53
|
+
var marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
|
|
54
|
+
var handleClick = (0, _react.useCallback)(function (event) {
|
|
55
|
+
var state = editorView.state,
|
|
56
|
+
dispatch = editorView.dispatch;
|
|
57
|
+
(0, _commands.selectColumn)(colIndex, event.shiftKey)(state, dispatch);
|
|
58
|
+
}, [colIndex, editorView]);
|
|
59
|
+
var handleMouseOver = (0, _react.useCallback)(function () {
|
|
60
|
+
var state = editorView.state,
|
|
61
|
+
dispatch = editorView.dispatch;
|
|
62
|
+
(0, _commands.hoverColumns)([colIndex])(state, dispatch);
|
|
63
|
+
}, [colIndex, editorView]);
|
|
64
|
+
var handleMouseOut = (0, _react.useCallback)(function () {
|
|
65
|
+
if (tableActive) {
|
|
66
|
+
var state = editorView.state,
|
|
67
|
+
dispatch = editorView.dispatch;
|
|
68
|
+
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
69
|
+
}
|
|
70
|
+
}, [editorView, tableActive]);
|
|
35
71
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
72
|
className: _types.TableCssClassName.COLUMN_CONTROLS_WITH_DRAG
|
|
37
73
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -41,22 +77,23 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
41
77
|
gridTemplateColumns: widths,
|
|
42
78
|
marginTop: marginTop
|
|
43
79
|
}
|
|
44
|
-
}, tableActive && !isResizing && Number.isFinite(colIndex) && /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
+
}, tableActive && !isResizing && !!hoveredCell && Number.isFinite(hoveredCell.colIndex) && /*#__PURE__*/_react.default.createElement("div", {
|
|
45
81
|
style: {
|
|
46
|
-
gridColumn:
|
|
82
|
+
gridColumn: gridColumnPosition,
|
|
47
83
|
marginTop: "-15px"
|
|
48
84
|
},
|
|
49
|
-
"data-column-control-index": colIndex,
|
|
85
|
+
"data-column-control-index": hoveredCell.colIndex,
|
|
50
86
|
"data-testid": "table-floating-column-control"
|
|
51
87
|
}, /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
52
88
|
direction: "column",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
tableLocalId: localId || '',
|
|
90
|
+
indexes: [hoveredCell.colIndex],
|
|
91
|
+
previewWidth: hoveredCell.colWidth,
|
|
92
|
+
previewHeight: hoveredCell.colHeight,
|
|
93
|
+
appearance: selectedColIndexes.includes(hoveredCell.colIndex) ? isInDanger ? 'danger' : 'selected' : 'default',
|
|
94
|
+
onClick: handleClick,
|
|
95
|
+
onMouseOver: handleMouseOver,
|
|
96
|
+
onMouseOut: handleMouseOut
|
|
60
97
|
}))));
|
|
61
98
|
};
|
|
62
99
|
var _default = exports.default = ColumnControls;
|
|
@@ -28,7 +28,8 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
|
|
|
28
28
|
hoveredCell = _ref.hoveredCell,
|
|
29
29
|
isResizing = _ref.isResizing,
|
|
30
30
|
stickyHeader = _ref.stickyHeader,
|
|
31
|
-
selection = _ref.selection
|
|
31
|
+
selection = _ref.selection,
|
|
32
|
+
isInDanger = _ref.isInDanger;
|
|
32
33
|
var _useState = (0, _react.useState)({
|
|
33
34
|
width: 0,
|
|
34
35
|
height: 0
|
|
@@ -118,6 +119,7 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
|
|
|
118
119
|
tableActive: tableActive,
|
|
119
120
|
stickyTop: tableActive ? stickyTop : undefined,
|
|
120
121
|
localId: currentNodeLocalId,
|
|
122
|
+
isInDanger: isInDanger,
|
|
121
123
|
rowHeights: rowHeights,
|
|
122
124
|
colWidths: colWidths
|
|
123
125
|
}), hasDropTargets && /*#__PURE__*/_react.default.createElement(_ColumnDropTargets.ColumnDropTargets, {
|
|
@@ -18,7 +18,6 @@ var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
|
18
18
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
19
19
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
20
20
|
var _commands = require("../../../commands");
|
|
21
|
-
var _pluginFactory = require("../../../pm-plugins/plugin-factory");
|
|
22
21
|
var _types = require("../../../types");
|
|
23
22
|
var _utils2 = require("../../../utils");
|
|
24
23
|
var _consts = require("../../consts");
|
|
@@ -72,22 +71,10 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
72
71
|
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateDragHandleLocation", function (rowIndex) {
|
|
76
|
-
var _this$props3 = _this.props,
|
|
77
|
-
editorView = _this$props3.editorView,
|
|
78
|
-
tableActive = _this$props3.tableActive;
|
|
79
|
-
var state = editorView.state,
|
|
80
|
-
dispatch = editorView.dispatch;
|
|
81
|
-
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
82
|
-
hoveredCell = _getPluginState.hoveredCell;
|
|
83
|
-
if (tableActive && hoveredCell.rowIndex !== rowIndex) {
|
|
84
|
-
(0, _commands.hoverCell)(rowIndex, hoveredCell.colIndex)(state, dispatch);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
74
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getCellStyles", function (index, rowHeight) {
|
|
88
|
-
var _this$
|
|
89
|
-
stickyTop = _this$
|
|
90
|
-
hasHeaderRow = _this$
|
|
75
|
+
var _this$props3 = _this.props,
|
|
76
|
+
stickyTop = _this$props3.stickyTop,
|
|
77
|
+
hasHeaderRow = _this$props3.hasHeaderRow;
|
|
91
78
|
if (stickyTop && hasHeaderRow && index === 0) {
|
|
92
79
|
return {
|
|
93
80
|
height: rowHeight,
|
|
@@ -101,11 +88,11 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
101
88
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getClassNames", function (index) {
|
|
102
89
|
var _classnames;
|
|
103
90
|
var isButtonDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
104
|
-
var _this$
|
|
105
|
-
hoveredRows = _this$
|
|
106
|
-
editorView = _this$
|
|
107
|
-
isInDanger = _this$
|
|
108
|
-
isResizing = _this$
|
|
91
|
+
var _this$props4 = _this.props,
|
|
92
|
+
hoveredRows = _this$props4.hoveredRows,
|
|
93
|
+
editorView = _this$props4.editorView,
|
|
94
|
+
isInDanger = _this$props4.isInDanger,
|
|
95
|
+
isResizing = _this$props4.isResizing;
|
|
109
96
|
var isActive = (0, _utils.isRowSelected)(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
110
97
|
return (0, _classnames2.default)(_types.TableCssClassName.NUMBERED_COLUMN_BUTTON, (_classnames = {}, (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON_DISABLED, isButtonDisabled), (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.HOVERED_CELL_IN_DANGER, isActive && isInDanger), (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.HOVERED_CELL_ACTIVE, isActive), _classnames));
|
|
111
98
|
});
|
|
@@ -115,11 +102,12 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
115
102
|
key: "render",
|
|
116
103
|
value: function render() {
|
|
117
104
|
var _this2 = this;
|
|
118
|
-
var _this$
|
|
119
|
-
tableRef = _this$
|
|
120
|
-
hasHeaderRow = _this$
|
|
121
|
-
isDragAndDropEnabled = _this$
|
|
122
|
-
tableActive = _this$
|
|
105
|
+
var _this$props5 = this.props,
|
|
106
|
+
tableRef = _this$props5.tableRef,
|
|
107
|
+
hasHeaderRow = _this$props5.hasHeaderRow,
|
|
108
|
+
isDragAndDropEnabled = _this$props5.isDragAndDropEnabled,
|
|
109
|
+
tableActive = _this$props5.tableActive,
|
|
110
|
+
updateCellHoverLocation = _this$props5.updateCellHoverLocation;
|
|
123
111
|
var rowHeights = (0, _utils2.getRowHeights)(tableRef);
|
|
124
112
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
125
113
|
className: _types.TableCssClassName.NUMBERED_COLUMN,
|
|
@@ -135,7 +123,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
135
123
|
"data-index": index,
|
|
136
124
|
style: _this2.getCellStyles(index, rowHeight),
|
|
137
125
|
onMouseOver: function onMouseOver() {
|
|
138
|
-
return
|
|
126
|
+
return updateCellHoverLocation(index);
|
|
139
127
|
}
|
|
140
128
|
}, hasHeaderRow ? index > 0 ? index : null : index + 1) : /*#__PURE__*/_react.default.createElement("div", {
|
|
141
129
|
key: "wrapper-".concat(index),
|
|
@@ -1,57 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.DragControls = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _editorTables = require("@atlaskit/editor-tables");
|
|
10
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
|
+
var _commands = require("../../../commands");
|
|
11
13
|
var _types = require("../../../types");
|
|
12
14
|
var _utils2 = require("../../../utils");
|
|
13
15
|
var _DragHandle = require("../../DragHandle");
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
var getSelectedRows = function getSelectedRows(selection) {
|
|
19
|
+
if (selection instanceof _editorTables.CellSelection && selection.isRowSelection()) {
|
|
20
|
+
var rect = (0, _utils.getSelectionRect)(selection);
|
|
21
|
+
if (!rect) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return (0, _utils2.getSelectedRowIndexes)(rect);
|
|
25
|
+
}
|
|
26
|
+
return [];
|
|
27
|
+
};
|
|
14
28
|
var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
15
29
|
var tableRef = _ref.tableRef,
|
|
16
30
|
hoveredCell = _ref.hoveredCell,
|
|
31
|
+
tableActive = _ref.tableActive,
|
|
32
|
+
editorView = _ref.editorView,
|
|
33
|
+
isInDanger = _ref.isInDanger,
|
|
17
34
|
hoverRows = _ref.hoverRows,
|
|
18
35
|
selectRow = _ref.selectRow,
|
|
19
|
-
|
|
20
|
-
editorView = _ref.editorView;
|
|
36
|
+
updateCellHoverLocation = _ref.updateCellHoverLocation;
|
|
21
37
|
var rowHeights = (0, _utils2.getRowHeights)(tableRef);
|
|
22
|
-
var heights = rowHeights.map(function (height
|
|
38
|
+
var heights = rowHeights.map(function (height) {
|
|
23
39
|
return "".concat(height - 1, "px");
|
|
24
40
|
}).join(' ');
|
|
41
|
+
var selectedRowIndexes = getSelectedRows(editorView.state.selection);
|
|
25
42
|
var rowWidth = tableRef.offsetWidth;
|
|
26
|
-
var _onClick = function onClick(index, event) {};
|
|
27
|
-
var onMouseOver = function onMouseOver() {};
|
|
28
|
-
var onMouseOut = function onMouseOut() {};
|
|
29
43
|
var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
44
|
+
var gridRowPosition = (0, _react.useMemo)(function () {
|
|
45
|
+
// if more than one row is selected, ensure the handle spans over the selected range
|
|
46
|
+
if (selectedRowIndexes.includes(rowIndex)) {
|
|
47
|
+
return "".concat(selectedRowIndexes[0] + 1, " / span ").concat(selectedRowIndexes.length);
|
|
48
|
+
}
|
|
49
|
+
return "".concat(rowIndex + 1, " / span 1");
|
|
50
|
+
}, [rowIndex, selectedRowIndexes]);
|
|
30
51
|
var getLocalId = function getLocalId() {
|
|
31
52
|
var _tableNode$node;
|
|
32
53
|
var tableNode = (0, _utils.findTable)(editorView.state.selection);
|
|
33
54
|
return (tableNode === null || tableNode === void 0 || (_tableNode$node = tableNode.node) === null || _tableNode$node === void 0 || (_tableNode$node = _tableNode$node.attrs) === null || _tableNode$node === void 0 ? void 0 : _tableNode$node.localId) || '';
|
|
34
55
|
};
|
|
56
|
+
var handleMouseOut = (0, _react.useCallback)(function () {
|
|
57
|
+
if (tableActive) {
|
|
58
|
+
var state = editorView.state,
|
|
59
|
+
dispatch = editorView.dispatch;
|
|
60
|
+
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
61
|
+
}
|
|
62
|
+
}, [editorView, tableActive]);
|
|
63
|
+
var handleMouseMove = (0, _react.useCallback)(function (e) {
|
|
64
|
+
// avoid updating if event target is drag handle
|
|
65
|
+
if (!e.nativeEvent.target.classList.contains(_types.TableCssClassName.ROW_CONTROLS_WITH_DRAG)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
var hoverHeight = e.nativeEvent.offsetY;
|
|
69
|
+
var totalHeight = 0;
|
|
70
|
+
var rowIndex = rowHeights.findIndex(function (row) {
|
|
71
|
+
totalHeight += row;
|
|
72
|
+
return hoverHeight <= totalHeight;
|
|
73
|
+
});
|
|
74
|
+
updateCellHoverLocation(rowIndex);
|
|
75
|
+
}, [updateCellHoverLocation, rowHeights]);
|
|
76
|
+
var handleMouseOver = (0, _react.useCallback)(function () {
|
|
77
|
+
hoverRows([rowIndex]);
|
|
78
|
+
}, [hoverRows, rowIndex]);
|
|
79
|
+
var handleClick = (0, _react.useCallback)(function (e) {
|
|
80
|
+
selectRow(rowIndex, e === null || e === void 0 ? void 0 : e.shiftKey);
|
|
81
|
+
}, [rowIndex, selectRow]);
|
|
35
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
83
|
className: _types.TableCssClassName.ROW_CONTROLS_WITH_DRAG,
|
|
37
84
|
style: {
|
|
38
85
|
gridTemplateRows: heights
|
|
39
|
-
}
|
|
40
|
-
|
|
86
|
+
},
|
|
87
|
+
onMouseMove: handleMouseMove
|
|
88
|
+
}, Number.isFinite(rowIndex) && /*#__PURE__*/_react.default.createElement("div", {
|
|
41
89
|
style: {
|
|
42
|
-
gridRow:
|
|
43
|
-
display: 'flex'
|
|
90
|
+
gridRow: gridRowPosition,
|
|
91
|
+
display: 'flex',
|
|
92
|
+
height: '100%',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
justifyContent: 'center'
|
|
44
95
|
}
|
|
45
96
|
}, /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
46
|
-
onClick: function onClick(event) {
|
|
47
|
-
return _onClick(rowIndex, event);
|
|
48
|
-
},
|
|
49
|
-
onMouseOver: onMouseOver,
|
|
50
|
-
onMouseOut: onMouseOut,
|
|
51
97
|
tableLocalId: getLocalId(),
|
|
52
98
|
indexes: [rowIndex],
|
|
53
99
|
previewWidth: rowWidth,
|
|
54
|
-
previewHeight: rowHeights[rowIndex]
|
|
100
|
+
previewHeight: rowHeights[rowIndex],
|
|
101
|
+
appearance: selectedRowIndexes.includes(rowIndex) ? isInDanger ? 'danger' : 'selected' : 'default',
|
|
102
|
+
onClick: handleClick,
|
|
103
|
+
onMouseOver: handleMouseOver,
|
|
104
|
+
onMouseOut: handleMouseOut
|
|
55
105
|
})));
|
|
56
106
|
};
|
|
57
107
|
var DragControls = exports.DragControls = (0, _reactIntlNext.injectIntl)(DragControlsComponent);
|
|
@@ -16,6 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
18
18
|
var _commands = require("../../commands");
|
|
19
|
+
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
19
20
|
var _utils2 = require("../../utils");
|
|
20
21
|
var _CornerControls = require("./CornerControls");
|
|
21
22
|
var _NumberColumn = _interopRequireDefault(require("./NumberColumn"));
|
|
@@ -53,6 +54,19 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
|
|
|
53
54
|
dispatch = _this$props$editorVie.dispatch;
|
|
54
55
|
(0, _commands.hoverRows)(rows, danger)(state, dispatch);
|
|
55
56
|
});
|
|
57
|
+
// re-use across numbered columns and row controls
|
|
58
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateCellHoverLocation", function (rowIndex) {
|
|
59
|
+
var _this$props = _this.props,
|
|
60
|
+
editorView = _this$props.editorView,
|
|
61
|
+
tableActive = _this$props.tableActive;
|
|
62
|
+
var state = editorView.state,
|
|
63
|
+
dispatch = editorView.dispatch;
|
|
64
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
65
|
+
hoveredCell = _getPluginState.hoveredCell;
|
|
66
|
+
if (tableActive && hoveredCell.rowIndex !== rowIndex) {
|
|
67
|
+
(0, _commands.hoverCell)(rowIndex, hoveredCell.colIndex)(state, dispatch);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
56
70
|
return _this;
|
|
57
71
|
}
|
|
58
72
|
(0, _createClass2.default)(TableFloatingControls, [{
|
|
@@ -99,20 +113,20 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
|
|
|
99
113
|
key: "shouldComponentUpdate",
|
|
100
114
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
101
115
|
var _this$state;
|
|
102
|
-
var _this$
|
|
103
|
-
tableRef = _this$
|
|
104
|
-
isInDanger = _this$
|
|
105
|
-
isResizing = _this$
|
|
106
|
-
isHeaderRowEnabled = _this$
|
|
107
|
-
isNumberColumnEnabled = _this$
|
|
108
|
-
hoveredRows = _this$
|
|
109
|
-
selection = _this$
|
|
110
|
-
tableActive = _this$
|
|
111
|
-
isHeaderColumnEnabled = _this$
|
|
112
|
-
ordering = _this$
|
|
113
|
-
headerRowHeight = _this$
|
|
114
|
-
stickyHeader = _this$
|
|
115
|
-
hoveredCell = _this$
|
|
116
|
+
var _this$props2 = this.props,
|
|
117
|
+
tableRef = _this$props2.tableRef,
|
|
118
|
+
isInDanger = _this$props2.isInDanger,
|
|
119
|
+
isResizing = _this$props2.isResizing,
|
|
120
|
+
isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
|
|
121
|
+
isNumberColumnEnabled = _this$props2.isNumberColumnEnabled,
|
|
122
|
+
hoveredRows = _this$props2.hoveredRows,
|
|
123
|
+
selection = _this$props2.selection,
|
|
124
|
+
tableActive = _this$props2.tableActive,
|
|
125
|
+
isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
|
|
126
|
+
ordering = _this$props2.ordering,
|
|
127
|
+
headerRowHeight = _this$props2.headerRowHeight,
|
|
128
|
+
stickyHeader = _this$props2.stickyHeader,
|
|
129
|
+
hoveredCell = _this$props2.hoveredCell;
|
|
116
130
|
var tableHeight = (_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.tableHeight;
|
|
117
131
|
var nextTableHeight = nextState === null || nextState === void 0 ? void 0 : nextState.tableHeight;
|
|
118
132
|
return ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableHeight !== nextTableHeight || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || (0, _utils2.isSelectionUpdated)(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell;
|
|
@@ -127,20 +141,20 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
|
|
|
127
141
|
}, {
|
|
128
142
|
key: "render",
|
|
129
143
|
value: function render() {
|
|
130
|
-
var _this$
|
|
131
|
-
editorView = _this$
|
|
132
|
-
tableRef = _this$
|
|
133
|
-
isInDanger = _this$
|
|
134
|
-
isResizing = _this$
|
|
135
|
-
isNumberColumnEnabled = _this$
|
|
136
|
-
isHeaderRowEnabled = _this$
|
|
137
|
-
isHeaderColumnEnabled = _this$
|
|
138
|
-
tableActive = _this$
|
|
139
|
-
hasHeaderRow = _this$
|
|
140
|
-
hoveredRows = _this$
|
|
141
|
-
stickyHeader = _this$
|
|
142
|
-
isDragAndDropEnabled = _this$
|
|
143
|
-
hoveredCell = _this$
|
|
144
|
+
var _this$props3 = this.props,
|
|
145
|
+
editorView = _this$props3.editorView,
|
|
146
|
+
tableRef = _this$props3.tableRef,
|
|
147
|
+
isInDanger = _this$props3.isInDanger,
|
|
148
|
+
isResizing = _this$props3.isResizing,
|
|
149
|
+
isNumberColumnEnabled = _this$props3.isNumberColumnEnabled,
|
|
150
|
+
isHeaderRowEnabled = _this$props3.isHeaderRowEnabled,
|
|
151
|
+
isHeaderColumnEnabled = _this$props3.isHeaderColumnEnabled,
|
|
152
|
+
tableActive = _this$props3.tableActive,
|
|
153
|
+
hasHeaderRow = _this$props3.hasHeaderRow,
|
|
154
|
+
hoveredRows = _this$props3.hoveredRows,
|
|
155
|
+
stickyHeader = _this$props3.stickyHeader,
|
|
156
|
+
isDragAndDropEnabled = _this$props3.isDragAndDropEnabled,
|
|
157
|
+
hoveredCell = _this$props3.hoveredCell;
|
|
144
158
|
if (!tableRef) {
|
|
145
159
|
return null;
|
|
146
160
|
}
|
|
@@ -159,14 +173,18 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
|
|
|
159
173
|
isInDanger: isInDanger,
|
|
160
174
|
isResizing: isResizing,
|
|
161
175
|
selectRow: this.selectRow,
|
|
176
|
+
updateCellHoverLocation: this.updateCellHoverLocation,
|
|
162
177
|
stickyTop: stickyTop,
|
|
163
178
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
164
179
|
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_RowControls.DragControls, {
|
|
165
180
|
tableRef: tableRef,
|
|
166
181
|
hoveredCell: hoveredCell,
|
|
167
182
|
editorView: editorView,
|
|
183
|
+
tableActive: tableActive,
|
|
184
|
+
isInDanger: isInDanger,
|
|
168
185
|
hoverRows: this.hoverRows,
|
|
169
|
-
selectRow: this.selectRow
|
|
186
|
+
selectRow: this.selectRow,
|
|
187
|
+
updateCellHoverLocation: this.updateCellHoverLocation
|
|
170
188
|
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CornerControls.CornerControls, {
|
|
171
189
|
editorView: editorView,
|
|
172
190
|
tableRef: tableRef,
|