@vuu-ui/vuu-table 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 +8 -8
- package/types/useTable.d.ts +1 -0
package/esm/index.js
CHANGED
|
@@ -612,6 +612,7 @@ import {
|
|
|
612
612
|
import {
|
|
613
613
|
applySort,
|
|
614
614
|
buildColumnMap as buildColumnMap2,
|
|
615
|
+
getIndexFromRowElement as getIndexFromRowElement2,
|
|
615
616
|
isGroupColumn as isGroupColumn3,
|
|
616
617
|
isJsonGroup as isJsonGroup2,
|
|
617
618
|
isValidNumber,
|
|
@@ -1648,7 +1649,7 @@ var useSelection = ({
|
|
|
1648
1649
|
|
|
1649
1650
|
// src/useTableContextMenu.ts
|
|
1650
1651
|
import { useContextMenu as usePopupContextMenu } from "@vuu-ui/vuu-popups";
|
|
1651
|
-
import { buildColumnMap } from "@vuu-ui/vuu-utils";
|
|
1652
|
+
import { buildColumnMap, getIndexFromRowElement } from "@vuu-ui/vuu-utils";
|
|
1652
1653
|
import { useCallback as useCallback14 } from "react";
|
|
1653
1654
|
var NO_ROWS = [];
|
|
1654
1655
|
var useTableContextMenu = ({
|
|
@@ -1660,14 +1661,13 @@ var useTableContextMenu = ({
|
|
|
1660
1661
|
const [showContextMenu] = usePopupContextMenu();
|
|
1661
1662
|
const onContextMenu = useCallback14(
|
|
1662
1663
|
(evt) => {
|
|
1663
|
-
var _a;
|
|
1664
1664
|
const target = evt.target;
|
|
1665
1665
|
const cellEl = target == null ? void 0 : target.closest("div[role='cell']");
|
|
1666
1666
|
const rowEl = target == null ? void 0 : target.closest("div[role='row']");
|
|
1667
1667
|
if (cellEl && rowEl) {
|
|
1668
1668
|
const { selectedRowsCount } = dataSource;
|
|
1669
1669
|
const columnMap = buildColumnMap(columns);
|
|
1670
|
-
const rowIndex =
|
|
1670
|
+
const rowIndex = getIndexFromRowElement(rowEl);
|
|
1671
1671
|
const cellIndex = Array.from(rowEl.childNodes).indexOf(cellEl);
|
|
1672
1672
|
const row = data.find(([idx]) => idx === rowIndex);
|
|
1673
1673
|
const columnName = columns[cellIndex];
|
|
@@ -2934,14 +2934,11 @@ var useTable = ({
|
|
|
2934
2934
|
const handleDragStartRow = useCallback19(
|
|
2935
2935
|
(dragDropState) => {
|
|
2936
2936
|
const { initialDragElement } = dragDropState;
|
|
2937
|
-
const rowIndex = initialDragElement
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
dragDropState.setPayload(row);
|
|
2943
|
-
} else {
|
|
2944
|
-
}
|
|
2937
|
+
const rowIndex = getIndexFromRowElement2(initialDragElement);
|
|
2938
|
+
const row = dataRef.current.find((row2) => row2[0] === rowIndex);
|
|
2939
|
+
if (row) {
|
|
2940
|
+
dragDropState.setPayload(row);
|
|
2941
|
+
} else {
|
|
2945
2942
|
}
|
|
2946
2943
|
onDragStart == null ? void 0 : onDragStart(dragDropState);
|
|
2947
2944
|
},
|
|
@@ -2959,6 +2956,7 @@ var useTable = ({
|
|
|
2959
2956
|
});
|
|
2960
2957
|
return {
|
|
2961
2958
|
...containerProps,
|
|
2959
|
+
"aria-rowcount": dataSource.size,
|
|
2962
2960
|
draggableRow,
|
|
2963
2961
|
onBlur: editingBlur,
|
|
2964
2962
|
onDoubleClick: editingDoubleClick,
|