@atlaskit/editor-plugin-table 5.4.14 → 5.4.15
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/afm-cc/tsconfig.json +70 -0
- package/dist/cjs/plugins/table/commands/hover.js +26 -6
- package/dist/cjs/plugins/table/commands/index.js +6 -0
- package/dist/cjs/plugins/table/commands/misc.js +8 -3
- package/dist/cjs/plugins/table/event-handlers.js +56 -34
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +4 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +7 -6
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +39 -7
- package/dist/cjs/plugins/table/pm-plugins/main.js +5 -3
- package/dist/cjs/plugins/table/reducer.js +1 -0
- package/dist/cjs/plugins/table/toolbar.js +6 -3
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +6 -3
- package/dist/cjs/plugins/table/ui/DragPreview/index.js +0 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -7
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +7 -4
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -8
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +12 -8
- package/dist/cjs/plugins/table/utils/dom.js +16 -1
- package/dist/cjs/plugins/table/utils/index.js +6 -0
- package/dist/es2019/plugins/table/commands/hover.js +22 -5
- package/dist/es2019/plugins/table/commands/index.js +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +8 -3
- package/dist/es2019/plugins/table/event-handlers.js +45 -20
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +4 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +7 -6
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +36 -3
- package/dist/es2019/plugins/table/pm-plugins/main.js +6 -4
- package/dist/es2019/plugins/table/reducer.js +1 -0
- package/dist/es2019/plugins/table/toolbar.js +5 -3
- package/dist/es2019/plugins/table/ui/ColumnResizeWidget/index.js +5 -3
- package/dist/es2019/plugins/table/ui/DragPreview/index.js +0 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +9 -7
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -9
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +5 -3
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +6 -4
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +14 -8
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +12 -9
- package/dist/es2019/plugins/table/utils/dom.js +13 -0
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/commands/hover.js +25 -5
- package/dist/esm/plugins/table/commands/index.js +1 -1
- package/dist/esm/plugins/table/commands/misc.js +8 -3
- package/dist/esm/plugins/table/event-handlers.js +55 -33
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +4 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +7 -6
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +35 -3
- package/dist/esm/plugins/table/pm-plugins/main.js +6 -4
- package/dist/esm/plugins/table/reducer.js +1 -0
- package/dist/esm/plugins/table/toolbar.js +5 -3
- package/dist/esm/plugins/table/ui/ColumnResizeWidget/index.js +5 -3
- package/dist/esm/plugins/table/ui/DragPreview/index.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +9 -7
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +11 -9
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +5 -3
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +6 -4
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -8
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +12 -8
- package/dist/esm/plugins/table/utils/dom.js +15 -0
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types/plugins/table/commands/index.d.ts +1 -1
- package/dist/types/plugins/table/commands/misc.d.ts +1 -1
- package/dist/types/plugins/table/event-handlers.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +6 -2
- 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/dom.d.ts +4 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +6 -2
- 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/dom.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/__tests__/unit/event-handlers.ts +2 -2
- package/src/__tests__/unit/ui/RowDragControls.tsx +1 -0
- package/src/plugins/table/commands/hover.ts +37 -7
- package/src/plugins/table/commands/index.ts +1 -0
- package/src/plugins/table/commands/misc.ts +9 -3
- package/src/plugins/table/event-handlers.ts +47 -29
- package/src/plugins/table/nodeviews/TableComponent.tsx +4 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +7 -5
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +37 -2
- package/src/plugins/table/pm-plugins/main.ts +6 -3
- package/src/plugins/table/reducer.ts +1 -0
- package/src/plugins/table/types.ts +7 -2
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +14 -5
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +3 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +3 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +12 -5
- package/src/plugins/table/utils/dom.ts +22 -0
- package/src/plugins/table/utils/index.ts +1 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
2
4
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -32,7 +34,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
32
34
|
return null;
|
|
33
35
|
}
|
|
34
36
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
35
|
-
return
|
|
37
|
+
return jsx(Popup, {
|
|
36
38
|
alignX: "right",
|
|
37
39
|
alignY: "top",
|
|
38
40
|
target: targetCellRef,
|
|
@@ -48,9 +50,9 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
48
50
|
forcePlacement: true,
|
|
49
51
|
offset: [-7, 0],
|
|
50
52
|
stick: true
|
|
51
|
-
},
|
|
53
|
+
}, jsx("div", {
|
|
52
54
|
css: tablePopupStyles
|
|
53
|
-
},
|
|
55
|
+
}, jsx(ContextualMenu, {
|
|
54
56
|
editorView: editorView,
|
|
55
57
|
offset: [contextualMenuTriggerSize / 2, -contextualMenuTriggerSize],
|
|
56
58
|
isOpen: isOpen,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
2
4
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
3
5
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
4
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -29,15 +31,15 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig) {
|
|
|
29
31
|
name: item.id
|
|
30
32
|
},
|
|
31
33
|
isDisabled: item.disabled,
|
|
32
|
-
elemBefore: item.icon ?
|
|
34
|
+
elemBefore: item.icon ? jsx("div", {
|
|
33
35
|
style: {
|
|
34
36
|
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
35
37
|
display: 'flex'
|
|
36
38
|
}
|
|
37
|
-
},
|
|
39
|
+
}, jsx(item.icon, {
|
|
38
40
|
label: item.title
|
|
39
41
|
})) : undefined,
|
|
40
|
-
elemAfter: item.keymap ?
|
|
42
|
+
elemAfter: item.keymap ? jsx("div", {
|
|
41
43
|
css: shortcutStyle
|
|
42
44
|
}, item.keymap) : undefined
|
|
43
45
|
});
|
|
@@ -129,7 +131,7 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
129
131
|
if (!menuItems) {
|
|
130
132
|
return null;
|
|
131
133
|
}
|
|
132
|
-
return
|
|
134
|
+
return jsx(DropdownMenu, {
|
|
133
135
|
mountTo: mountPoint
|
|
134
136
|
//This needs be removed when the a11y is completely handled
|
|
135
137
|
//Disabling key navigation now as it works only partially
|
|
@@ -17,7 +17,7 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
17
17
|
return [];
|
|
18
18
|
};
|
|
19
19
|
export var ColumnControls = function ColumnControls(_ref) {
|
|
20
|
-
var _colWidths$map$join, _rowHeights
|
|
20
|
+
var _colWidths$map$join, _rowHeights$, _rowHeights$reduce, _colWidths;
|
|
21
21
|
var editorView = _ref.editorView,
|
|
22
22
|
tableActive = _ref.tableActive,
|
|
23
23
|
tableRef = _ref.tableRef,
|
|
@@ -28,7 +28,8 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
28
28
|
isInDanger = _ref.isInDanger,
|
|
29
29
|
rowHeights = _ref.rowHeights,
|
|
30
30
|
colWidths = _ref.colWidths,
|
|
31
|
-
hasHeaderColumn = _ref.hasHeaderColumn
|
|
31
|
+
hasHeaderColumn = _ref.hasHeaderColumn,
|
|
32
|
+
isTableHovered = _ref.isTableHovered;
|
|
32
33
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
33
34
|
return width ? "".concat(width - 1, "px") : '0px';
|
|
34
35
|
}).join(' ')) !== null && _colWidths$map$join !== void 0 ? _colWidths$map$join : '0px';
|
|
@@ -68,10 +69,14 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
68
69
|
// update hovered cell location
|
|
69
70
|
var state = editorView.state,
|
|
70
71
|
dispatch = editorView.dispatch;
|
|
71
|
-
if (tableActive
|
|
72
|
-
|
|
72
|
+
if (tableActive) {
|
|
73
|
+
// For context: Whenever we mouse over a column or row drag handle, we will ALWAYS be hovering over the 0 index
|
|
74
|
+
// of the opposite dimension. For example; here when we mouse over the column drag handle then we're technically
|
|
75
|
+
// also hovering over row 0 index. And vice-versa with rows. This means we don't need to worry about knowing the
|
|
76
|
+
// current row index. We can just force it to 0.
|
|
77
|
+
hoverCell(0, Number(colIndex))(state, dispatch);
|
|
73
78
|
}
|
|
74
|
-
}, [editorView,
|
|
79
|
+
}, [editorView, tableActive]);
|
|
75
80
|
var handleMouseOut = useCallback(function () {
|
|
76
81
|
if (tableActive) {
|
|
77
82
|
var state = editorView.state,
|
|
@@ -87,6 +92,9 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
87
92
|
var colIndexes = useMemo(function () {
|
|
88
93
|
return [colIndex];
|
|
89
94
|
}, [colIndex]);
|
|
95
|
+
var previewHeight = (_rowHeights$reduce = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights.reduce(function (sum, cur) {
|
|
96
|
+
return sum + cur;
|
|
97
|
+
}, 0)) !== null && _rowHeights$reduce !== void 0 ? _rowHeights$reduce : 0;
|
|
90
98
|
return /*#__PURE__*/React.createElement("div", {
|
|
91
99
|
className: ClassName.DRAG_COLUMN_CONTROLS,
|
|
92
100
|
onMouseMove: handleMouseMove
|
|
@@ -115,7 +123,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
115
123
|
right: '0'
|
|
116
124
|
} : {}
|
|
117
125
|
}));
|
|
118
|
-
}), tableActive && !isResizing && !!hoveredCell && Number.isFinite(hoveredCell.colIndex) && /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
}), tableActive && !isResizing && isTableHovered && !!hoveredCell && Number.isFinite(hoveredCell.colIndex) && /*#__PURE__*/React.createElement("div", {
|
|
119
127
|
style: {
|
|
120
128
|
gridColumn: gridColumnPosition,
|
|
121
129
|
display: 'flex',
|
|
@@ -131,8 +139,8 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
131
139
|
direction: "column",
|
|
132
140
|
tableLocalId: localId || '',
|
|
133
141
|
indexes: colIndexes,
|
|
134
|
-
previewWidth:
|
|
135
|
-
previewHeight:
|
|
142
|
+
previewWidth: (_colWidths = colWidths === null || colWidths === void 0 ? void 0 : colWidths[colIndex]) !== null && _colWidths !== void 0 ? _colWidths : 48,
|
|
143
|
+
previewHeight: previewHeight,
|
|
136
144
|
appearance: selectedColIndexes.includes(hoveredCell.colIndex) ? isInDanger ? 'danger' : 'selected' : 'default',
|
|
137
145
|
onClick: handleClick,
|
|
138
146
|
onMouseOver: handleMouseOver,
|
|
@@ -18,7 +18,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
18
18
|
isResizing = _ref.isResizing,
|
|
19
19
|
stickyHeader = _ref.stickyHeader,
|
|
20
20
|
selection = _ref.selection,
|
|
21
|
-
isInDanger = _ref.isInDanger
|
|
21
|
+
isInDanger = _ref.isInDanger,
|
|
22
|
+
isTableHovered = _ref.isTableHovered;
|
|
22
23
|
var _useState = useState({
|
|
23
24
|
width: 0,
|
|
24
25
|
height: 0
|
|
@@ -103,6 +104,7 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
103
104
|
tableRef: tableRef,
|
|
104
105
|
isResizing: isResizing,
|
|
105
106
|
tableActive: tableActive,
|
|
107
|
+
isTableHovered: isTableHovered,
|
|
106
108
|
stickyTop: tableActive ? stickyTop : undefined,
|
|
107
109
|
localId: currentNodeLocalId,
|
|
108
110
|
isInDanger: isInDanger,
|
|
@@ -32,6 +32,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
32
32
|
editorView = _ref.editorView,
|
|
33
33
|
isInDanger = _ref.isInDanger,
|
|
34
34
|
isResizing = _ref.isResizing,
|
|
35
|
+
isTableHovered = _ref.isTableHovered,
|
|
35
36
|
hoverRows = _ref.hoverRows,
|
|
36
37
|
selectRow = _ref.selectRow,
|
|
37
38
|
updateCellHoverLocation = _ref.updateCellHoverLocation;
|
|
@@ -147,7 +148,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
147
148
|
left: "var(--ds-space-negative-100, -8px)"
|
|
148
149
|
}
|
|
149
150
|
}));
|
|
150
|
-
}), !isResizing && Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
}), !isResizing && isTableHovered && Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
|
|
151
152
|
style: {
|
|
152
153
|
gridRow: gridRowPosition,
|
|
153
154
|
gridColumn: '2',
|
|
@@ -13,7 +13,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
13
|
import React, { Component } from 'react';
|
|
14
14
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
15
15
|
import { hoverCell, hoverRows, selectRow } from '../../commands';
|
|
16
|
-
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
17
16
|
import { TableCssClassName as ClassName } from '../../types';
|
|
18
17
|
import { isSelectionUpdated } from '../../utils';
|
|
19
18
|
import { CornerControls, DragCornerControls } from './CornerControls';
|
|
@@ -49,10 +48,12 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
49
48
|
tableActive = _this$props.tableActive;
|
|
50
49
|
var state = editorView.state,
|
|
51
50
|
dispatch = editorView.dispatch;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
if (tableActive) {
|
|
52
|
+
// For context: Whenever we mouse over a column or row drag handle, we will ALWAYS be hovering over the 0 index
|
|
53
|
+
// of the opposite dimension. For example; here when we mouse over the row drag handle then we're technically
|
|
54
|
+
// also hovering over column 0 index. And vice-versa with columns. This means we don't need to worry about knowing the
|
|
55
|
+
// current column index. We can just force it to 0.
|
|
56
|
+
hoverCell(rowIndex, 0)(state, dispatch);
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
_this.state = {
|
|
@@ -124,8 +125,9 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
124
125
|
ordering = _this$props2.ordering,
|
|
125
126
|
headerRowHeight = _this$props2.headerRowHeight,
|
|
126
127
|
stickyHeader = _this$props2.stickyHeader,
|
|
127
|
-
hoveredCell = _this$props2.hoveredCell
|
|
128
|
-
|
|
128
|
+
hoveredCell = _this$props2.hoveredCell,
|
|
129
|
+
isTableHovered = _this$props2.isTableHovered;
|
|
130
|
+
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;
|
|
129
131
|
}
|
|
130
132
|
}, {
|
|
131
133
|
key: "componentWillUnmount",
|
|
@@ -151,7 +153,8 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
151
153
|
hoveredRows = _this$props3.hoveredRows,
|
|
152
154
|
stickyHeader = _this$props3.stickyHeader,
|
|
153
155
|
isDragAndDropEnabled = _this$props3.isDragAndDropEnabled,
|
|
154
|
-
hoveredCell = _this$props3.hoveredCell
|
|
156
|
+
hoveredCell = _this$props3.hoveredCell,
|
|
157
|
+
isTableHovered = _this$props3.isTableHovered;
|
|
155
158
|
if (!tableRef) {
|
|
156
159
|
return null;
|
|
157
160
|
}
|
|
@@ -185,6 +188,7 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
|
|
|
185
188
|
tableRef: tableRef,
|
|
186
189
|
tableNode: tableNode,
|
|
187
190
|
hoveredCell: hoveredCell,
|
|
191
|
+
isTableHovered: isTableHovered,
|
|
188
192
|
editorView: editorView,
|
|
189
193
|
tableActive: tableActive,
|
|
190
194
|
isInDanger: isInDanger,
|
|
@@ -200,4 +200,19 @@ export var getTop = function getTop(element) {
|
|
|
200
200
|
return 0;
|
|
201
201
|
}
|
|
202
202
|
return (_element$getBoundingC = element === null || element === void 0 || (_element$getBoundingC2 = element.getBoundingClientRect) === null || _element$getBoundingC2 === void 0 || (_element$getBoundingC2 = _element$getBoundingC2.call(element)) === null || _element$getBoundingC2 === void 0 ? void 0 : _element$getBoundingC2.top) !== null && _element$getBoundingC !== void 0 ? _element$getBoundingC : 0;
|
|
203
|
+
};
|
|
204
|
+
export var findNearestCellIndexToPoint = function findNearestCellIndexToPoint(x, y) {
|
|
205
|
+
var _cell$parentElement;
|
|
206
|
+
var elements = document.elementsFromPoint(x, y);
|
|
207
|
+
var cell = elements.find(function (el) {
|
|
208
|
+
return el.nodeName.toUpperCase() === 'TD' || el.nodeName.toUpperCase() === 'TH';
|
|
209
|
+
});
|
|
210
|
+
var row = (_cell$parentElement = cell === null || cell === void 0 ? void 0 : cell.parentElement) !== null && _cell$parentElement !== void 0 ? _cell$parentElement : undefined;
|
|
211
|
+
if (!Number.isFinite(row === null || row === void 0 ? void 0 : row.rowIndex) || !Number.isFinite(cell === null || cell === void 0 ? void 0 : cell.cellIndex)) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
row: row.rowIndex,
|
|
216
|
+
col: cell.cellIndex
|
|
217
|
+
};
|
|
203
218
|
};
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow } from './row-controls';
|
|
8
8
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
@@ -6,4 +6,5 @@ export declare const hoverTable: (isInDanger?: boolean, isSelected?: boolean) =>
|
|
|
6
6
|
export declare const clearHoverSelection: () => import("@atlaskit/editor-common/types").Command;
|
|
7
7
|
export declare const showResizeHandleLine: (cellColumnPositioning: CellColumnPositioning) => import("@atlaskit/editor-common/types").Command;
|
|
8
8
|
export declare const hideResizeHandleLine: () => import("@atlaskit/editor-common/types").Command;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const setTableHovered: (hovered: boolean) => import("@atlaskit/editor-common/types").Command;
|
|
10
|
+
export declare const hoverCell: (rowIndex?: number, colIndex?: number) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, } from './hover';
|
|
1
|
+
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered, } from './hover';
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
@@ -13,7 +13,7 @@ export declare const transformSliceToRemoveColumnsWidths: (slice: Slice, schema:
|
|
|
13
13
|
export declare const countCellsInSlice: (slice: Slice, schema: Schema, type?: 'row' | 'column') => number;
|
|
14
14
|
export declare const getTableSelectionType: (selection: Selection) => "row" | "column" | undefined;
|
|
15
15
|
export declare const getTableElementMoveTypeBySlice: (slice: Slice, state: EditorState) => "row" | "column" | undefined;
|
|
16
|
-
export declare const isInsideFirstCellOfRowOrColumn: (selection: Selection, type?: 'row' | 'column') => boolean
|
|
16
|
+
export declare const isInsideFirstCellOfRowOrColumn: (selection: Selection, type?: 'row' | 'column') => boolean;
|
|
17
17
|
export declare const deleteTable: Command;
|
|
18
18
|
export declare const deleteTableIfSelected: Command;
|
|
19
19
|
export declare const convertFirstRowToHeader: (schema: Schema) => (tr: Transaction) => Transaction;
|
|
@@ -8,9 +8,11 @@ export declare const handleClick: (view: EditorView, event: Event) => boolean;
|
|
|
8
8
|
export declare const handleMouseOver: (view: EditorView, mouseEvent: Event) => boolean;
|
|
9
9
|
export declare const handleMouseDown: (_: EditorView, event: Event) => boolean;
|
|
10
10
|
export declare const handleMouseOut: (view: EditorView, mouseEvent: Event) => boolean;
|
|
11
|
+
export declare const handleMouseEnter: (view: EditorView, mouseEvent: Event) => boolean;
|
|
11
12
|
export declare const handleMouseLeave: (view: EditorView, event: Event) => boolean;
|
|
12
13
|
export declare const handleMouseMove: (view: EditorView, event: Event, elementContentRects?: ElementContentRects) => boolean;
|
|
13
14
|
export declare function handleTripleClick(view: EditorView, pos: number): boolean;
|
|
14
15
|
export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView) => Transaction;
|
|
16
|
+
export declare const isTableInFocus: (view: EditorView) => boolean;
|
|
15
17
|
export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
16
18
|
export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
@@ -8,5 +8,5 @@ export declare const getDecorations: (state: EditorState) => DecorationSet;
|
|
|
8
8
|
export declare const updatePluginStateDecorations: (state: EditorState, decorations: Decoration[], key: TableDecorations) => DecorationSet;
|
|
9
9
|
export declare const setDropTarget: (type: DropTargetType, index: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
10
10
|
export declare const clearDropTarget: (tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
11
|
-
export declare const moveSource: (sourceType: DraggableType, sourceIndex: number, targetIndex: number) => import("@atlaskit/editor-common/types").Command;
|
|
11
|
+
export declare const moveSource: (sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
12
12
|
export declare const toggleDragMenu: (isDragMenuOpen: boolean | undefined, direction?: TableDirection, index?: number) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -47,8 +47,6 @@ export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
|
|
|
47
47
|
export interface CellHoverMeta {
|
|
48
48
|
colIndex?: number;
|
|
49
49
|
rowIndex?: number;
|
|
50
|
-
colWidth?: number;
|
|
51
|
-
colHeight?: number;
|
|
52
50
|
}
|
|
53
51
|
export interface TablePluginState {
|
|
54
52
|
editorHasFocus?: boolean;
|
|
@@ -82,6 +80,7 @@ export interface TablePluginState {
|
|
|
82
80
|
wasFullWidthModeEnabled?: boolean;
|
|
83
81
|
isTableResizingEnabled?: boolean;
|
|
84
82
|
isDragAndDropEnabled?: boolean;
|
|
83
|
+
isTableHovered?: boolean;
|
|
85
84
|
}
|
|
86
85
|
export type TablePluginAction = {
|
|
87
86
|
type: 'SET_EDITOR_FOCUS';
|
|
@@ -175,6 +174,11 @@ export type TablePluginAction = {
|
|
|
175
174
|
data: {
|
|
176
175
|
hoveredCell: CellHoverMeta;
|
|
177
176
|
};
|
|
177
|
+
} | {
|
|
178
|
+
type: 'TABLE_HOVERED';
|
|
179
|
+
data: {
|
|
180
|
+
isTableHovered: boolean;
|
|
181
|
+
};
|
|
178
182
|
} | {
|
|
179
183
|
type: 'SET_TARGET_CELL_POSITION';
|
|
180
184
|
data: {
|
|
@@ -13,6 +13,7 @@ export interface ColumnControlsProps {
|
|
|
13
13
|
rowHeights?: number[];
|
|
14
14
|
colWidths?: (number | undefined)[];
|
|
15
15
|
hasHeaderColumn?: boolean;
|
|
16
|
+
isTableHovered?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, }: ColumnControlsProps) => JSX.Element;
|
|
18
|
+
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, }: ColumnControlsProps) => JSX.Element;
|
|
18
19
|
export default ColumnControls;
|
|
@@ -21,6 +21,7 @@ export interface Props {
|
|
|
21
21
|
isResizing?: boolean;
|
|
22
22
|
ordering?: TableColumnOrdering;
|
|
23
23
|
stickyHeader?: RowStickyState;
|
|
24
|
+
isTableHovered?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export declare const TableFloatingColumnControls: React.FC<Props>;
|
|
26
27
|
export default TableFloatingColumnControls;
|
|
@@ -12,6 +12,7 @@ type DragControlsProps = {
|
|
|
12
12
|
hoveredCell?: CellHoverMeta;
|
|
13
13
|
isInDanger?: boolean;
|
|
14
14
|
isResizing?: boolean;
|
|
15
|
+
isTableHovered?: boolean;
|
|
15
16
|
hoverRows: (rows: number[], danger?: boolean) => void;
|
|
16
17
|
selectRow: (row: number, expand: boolean) => void;
|
|
17
18
|
updateCellHoverLocation: (rowIndex: number) => void;
|
|
@@ -26,3 +26,7 @@ export type TableDOMElements = {
|
|
|
26
26
|
};
|
|
27
27
|
export declare const getTree: (tr: HTMLTableRowElement) => TableDOMElements | null;
|
|
28
28
|
export declare const getTop: (element: HTMLElement | Window | undefined) => number;
|
|
29
|
+
export declare const findNearestCellIndexToPoint: (x: number, y: number) => {
|
|
30
|
+
row: number;
|
|
31
|
+
col: number;
|
|
32
|
+
} | undefined;
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow, } from './row-controls';
|
|
8
8
|
export type { RowParams } from './row-controls';
|
|
@@ -6,4 +6,5 @@ export declare const hoverTable: (isInDanger?: boolean, isSelected?: boolean) =>
|
|
|
6
6
|
export declare const clearHoverSelection: () => import("@atlaskit/editor-common/types").Command;
|
|
7
7
|
export declare const showResizeHandleLine: (cellColumnPositioning: CellColumnPositioning) => import("@atlaskit/editor-common/types").Command;
|
|
8
8
|
export declare const hideResizeHandleLine: () => import("@atlaskit/editor-common/types").Command;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const setTableHovered: (hovered: boolean) => import("@atlaskit/editor-common/types").Command;
|
|
10
|
+
export declare const hoverCell: (rowIndex?: number, colIndex?: number) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, } from './hover';
|
|
1
|
+
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered, } from './hover';
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
@@ -13,7 +13,7 @@ export declare const transformSliceToRemoveColumnsWidths: (slice: Slice, schema:
|
|
|
13
13
|
export declare const countCellsInSlice: (slice: Slice, schema: Schema, type?: 'row' | 'column') => number;
|
|
14
14
|
export declare const getTableSelectionType: (selection: Selection) => "row" | "column" | undefined;
|
|
15
15
|
export declare const getTableElementMoveTypeBySlice: (slice: Slice, state: EditorState) => "row" | "column" | undefined;
|
|
16
|
-
export declare const isInsideFirstCellOfRowOrColumn: (selection: Selection, type?: 'row' | 'column') => boolean
|
|
16
|
+
export declare const isInsideFirstCellOfRowOrColumn: (selection: Selection, type?: 'row' | 'column') => boolean;
|
|
17
17
|
export declare const deleteTable: Command;
|
|
18
18
|
export declare const deleteTableIfSelected: Command;
|
|
19
19
|
export declare const convertFirstRowToHeader: (schema: Schema) => (tr: Transaction) => Transaction;
|
|
@@ -8,9 +8,11 @@ export declare const handleClick: (view: EditorView, event: Event) => boolean;
|
|
|
8
8
|
export declare const handleMouseOver: (view: EditorView, mouseEvent: Event) => boolean;
|
|
9
9
|
export declare const handleMouseDown: (_: EditorView, event: Event) => boolean;
|
|
10
10
|
export declare const handleMouseOut: (view: EditorView, mouseEvent: Event) => boolean;
|
|
11
|
+
export declare const handleMouseEnter: (view: EditorView, mouseEvent: Event) => boolean;
|
|
11
12
|
export declare const handleMouseLeave: (view: EditorView, event: Event) => boolean;
|
|
12
13
|
export declare const handleMouseMove: (view: EditorView, event: Event, elementContentRects?: ElementContentRects) => boolean;
|
|
13
14
|
export declare function handleTripleClick(view: EditorView, pos: number): boolean;
|
|
14
15
|
export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView) => Transaction;
|
|
16
|
+
export declare const isTableInFocus: (view: EditorView) => boolean;
|
|
15
17
|
export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
16
18
|
export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
@@ -8,5 +8,5 @@ export declare const getDecorations: (state: EditorState) => DecorationSet;
|
|
|
8
8
|
export declare const updatePluginStateDecorations: (state: EditorState, decorations: Decoration[], key: TableDecorations) => DecorationSet;
|
|
9
9
|
export declare const setDropTarget: (type: DropTargetType, index: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
10
10
|
export declare const clearDropTarget: (tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
11
|
-
export declare const moveSource: (sourceType: DraggableType, sourceIndex: number, targetIndex: number) => import("@atlaskit/editor-common/types").Command;
|
|
11
|
+
export declare const moveSource: (sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
12
12
|
export declare const toggleDragMenu: (isDragMenuOpen: boolean | undefined, direction?: TableDirection, index?: number) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -47,8 +47,6 @@ export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
|
|
|
47
47
|
export interface CellHoverMeta {
|
|
48
48
|
colIndex?: number;
|
|
49
49
|
rowIndex?: number;
|
|
50
|
-
colWidth?: number;
|
|
51
|
-
colHeight?: number;
|
|
52
50
|
}
|
|
53
51
|
export interface TablePluginState {
|
|
54
52
|
editorHasFocus?: boolean;
|
|
@@ -82,6 +80,7 @@ export interface TablePluginState {
|
|
|
82
80
|
wasFullWidthModeEnabled?: boolean;
|
|
83
81
|
isTableResizingEnabled?: boolean;
|
|
84
82
|
isDragAndDropEnabled?: boolean;
|
|
83
|
+
isTableHovered?: boolean;
|
|
85
84
|
}
|
|
86
85
|
export type TablePluginAction = {
|
|
87
86
|
type: 'SET_EDITOR_FOCUS';
|
|
@@ -175,6 +174,11 @@ export type TablePluginAction = {
|
|
|
175
174
|
data: {
|
|
176
175
|
hoveredCell: CellHoverMeta;
|
|
177
176
|
};
|
|
177
|
+
} | {
|
|
178
|
+
type: 'TABLE_HOVERED';
|
|
179
|
+
data: {
|
|
180
|
+
isTableHovered: boolean;
|
|
181
|
+
};
|
|
178
182
|
} | {
|
|
179
183
|
type: 'SET_TARGET_CELL_POSITION';
|
|
180
184
|
data: {
|
package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface ColumnControlsProps {
|
|
|
13
13
|
rowHeights?: number[];
|
|
14
14
|
colWidths?: (number | undefined)[];
|
|
15
15
|
hasHeaderColumn?: boolean;
|
|
16
|
+
isTableHovered?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, }: ColumnControlsProps) => JSX.Element;
|
|
18
|
+
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, }: ColumnControlsProps) => JSX.Element;
|
|
18
19
|
export default ColumnControls;
|
|
@@ -21,6 +21,7 @@ export interface Props {
|
|
|
21
21
|
isResizing?: boolean;
|
|
22
22
|
ordering?: TableColumnOrdering;
|
|
23
23
|
stickyHeader?: RowStickyState;
|
|
24
|
+
isTableHovered?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export declare const TableFloatingColumnControls: React.FC<Props>;
|
|
26
27
|
export default TableFloatingColumnControls;
|
package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ type DragControlsProps = {
|
|
|
12
12
|
hoveredCell?: CellHoverMeta;
|
|
13
13
|
isInDanger?: boolean;
|
|
14
14
|
isResizing?: boolean;
|
|
15
|
+
isTableHovered?: boolean;
|
|
15
16
|
hoverRows: (rows: number[], danger?: boolean) => void;
|
|
16
17
|
selectRow: (row: number, expand: boolean) => void;
|
|
17
18
|
updateCellHoverLocation: (rowIndex: number) => void;
|
|
@@ -29,3 +29,7 @@ export type TableDOMElements = {
|
|
|
29
29
|
};
|
|
30
30
|
export declare const getTree: (tr: HTMLTableRowElement) => TableDOMElements | null;
|
|
31
31
|
export declare const getTop: (element: HTMLElement | Window | undefined) => number;
|
|
32
|
+
export declare const findNearestCellIndexToPoint: (x: number, y: number) => {
|
|
33
|
+
row: number;
|
|
34
|
+
col: number;
|
|
35
|
+
} | undefined;
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow, } from './row-controls';
|
|
8
8
|
export type { RowParams } from './row-controls';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.15",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^35.0.0",
|
|
31
|
-
"@atlaskit/custom-steps": "^0.0.
|
|
31
|
+
"@atlaskit/custom-steps": "^0.0.7",
|
|
32
32
|
"@atlaskit/editor-common": "^76.25.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.2",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
@@ -191,7 +191,7 @@ describe('table event handlers', () => {
|
|
|
191
191
|
|
|
192
192
|
describe('#handleMouseOver', () => {
|
|
193
193
|
describe('when insert col/row button is hidden', () => {
|
|
194
|
-
it('should
|
|
194
|
+
it('should set table as hovered', () => {
|
|
195
195
|
const { editorView } = editor(
|
|
196
196
|
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
197
197
|
);
|
|
@@ -205,7 +205,7 @@ describe('table event handlers', () => {
|
|
|
205
205
|
const event = {
|
|
206
206
|
target: editorView.dom.querySelector('td'),
|
|
207
207
|
};
|
|
208
|
-
expect(handleMouseOver(editorView, event as MouseEvent)).toEqual(
|
|
208
|
+
expect(handleMouseOver(editorView, event as MouseEvent)).toEqual(true);
|
|
209
209
|
});
|
|
210
210
|
});
|
|
211
211
|
|