@vuu-ui/vuu-table-extras 0.8.18-debug → 0.8.19-debug
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/cjs/index.js +7 -10
- package/cjs/index.js.map +2 -2
- package/esm/index.js +9 -11
- package/esm/index.js.map +3 -3
- package/package.json +11 -11
package/esm/index.js
CHANGED
|
@@ -673,6 +673,7 @@ import {
|
|
|
673
673
|
import {
|
|
674
674
|
applySort,
|
|
675
675
|
buildColumnMap as buildColumnMap2,
|
|
676
|
+
getIndexFromRowElement as getIndexFromRowElement2,
|
|
676
677
|
isGroupColumn as isGroupColumn3,
|
|
677
678
|
isJsonGroup as isJsonGroup2,
|
|
678
679
|
isValidNumber,
|
|
@@ -1709,7 +1710,7 @@ var useSelection = ({
|
|
|
1709
1710
|
|
|
1710
1711
|
// ../vuu-table/src/useTableContextMenu.ts
|
|
1711
1712
|
import { useContextMenu as usePopupContextMenu } from "@vuu-ui/vuu-popups";
|
|
1712
|
-
import { buildColumnMap } from "@vuu-ui/vuu-utils";
|
|
1713
|
+
import { buildColumnMap, getIndexFromRowElement } from "@vuu-ui/vuu-utils";
|
|
1713
1714
|
import { useCallback as useCallback14 } from "react";
|
|
1714
1715
|
var NO_ROWS = [];
|
|
1715
1716
|
var useTableContextMenu = ({
|
|
@@ -1721,14 +1722,13 @@ var useTableContextMenu = ({
|
|
|
1721
1722
|
const [showContextMenu] = usePopupContextMenu();
|
|
1722
1723
|
const onContextMenu = useCallback14(
|
|
1723
1724
|
(evt) => {
|
|
1724
|
-
var _a;
|
|
1725
1725
|
const target = evt.target;
|
|
1726
1726
|
const cellEl = target == null ? void 0 : target.closest("div[role='cell']");
|
|
1727
1727
|
const rowEl = target == null ? void 0 : target.closest("div[role='row']");
|
|
1728
1728
|
if (cellEl && rowEl) {
|
|
1729
1729
|
const { selectedRowsCount } = dataSource;
|
|
1730
1730
|
const columnMap = buildColumnMap(columns);
|
|
1731
|
-
const rowIndex =
|
|
1731
|
+
const rowIndex = getIndexFromRowElement(rowEl);
|
|
1732
1732
|
const cellIndex = Array.from(rowEl.childNodes).indexOf(cellEl);
|
|
1733
1733
|
const row = data.find(([idx]) => idx === rowIndex);
|
|
1734
1734
|
const columnName = columns[cellIndex];
|
|
@@ -2995,14 +2995,11 @@ var useTable = ({
|
|
|
2995
2995
|
const handleDragStartRow = useCallback19(
|
|
2996
2996
|
(dragDropState) => {
|
|
2997
2997
|
const { initialDragElement } = dragDropState;
|
|
2998
|
-
const rowIndex = initialDragElement
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
dragDropState.setPayload(row);
|
|
3004
|
-
} else {
|
|
3005
|
-
}
|
|
2998
|
+
const rowIndex = getIndexFromRowElement2(initialDragElement);
|
|
2999
|
+
const row = dataRef.current.find((row2) => row2[0] === rowIndex);
|
|
3000
|
+
if (row) {
|
|
3001
|
+
dragDropState.setPayload(row);
|
|
3002
|
+
} else {
|
|
3006
3003
|
}
|
|
3007
3004
|
onDragStart == null ? void 0 : onDragStart(dragDropState);
|
|
3008
3005
|
},
|
|
@@ -3020,6 +3017,7 @@ var useTable = ({
|
|
|
3020
3017
|
});
|
|
3021
3018
|
return {
|
|
3022
3019
|
...containerProps,
|
|
3020
|
+
"aria-rowcount": dataSource.size,
|
|
3023
3021
|
draggableRow,
|
|
3024
3022
|
onBlur: editingBlur,
|
|
3025
3023
|
onDoubleClick: editingDoubleClick,
|