@lensui/lens-table 0.1.69 → 0.1.71
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/dist/index.cjs +38 -17
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -990,8 +990,8 @@ function getVisibleHeaderActions(column, width, columnDraggable = false, titleWi
|
|
|
990
990
|
return { filter: visible.has("filter"), sort: visible.has("sort"), drag: visible.has("drag") };
|
|
991
991
|
}
|
|
992
992
|
function getMinimumColumnWidth(column, columnDraggable = false) {
|
|
993
|
-
if (column.rowDragHandle) return 36;
|
|
994
993
|
if (column.rowSelection) return Math.max(24, column.width ?? 44);
|
|
994
|
+
if (column.rowDragHandle) return 36;
|
|
995
995
|
if (column.rowNumber) return 44;
|
|
996
996
|
return 60;
|
|
997
997
|
}
|
|
@@ -1283,7 +1283,7 @@ function paintGrid(options) {
|
|
|
1283
1283
|
if (columnIndex === rangeColumnStart) ctx.fillRect(x, y, 2, cellHeight);
|
|
1284
1284
|
if (columnIndex === rangeColumnEnd) ctx.fillRect(x + cellWidth - 2, y, 2, cellHeight);
|
|
1285
1285
|
}
|
|
1286
|
-
if (column.rowDragHandle) {
|
|
1286
|
+
if (column.rowDragHandle && !column.rowSelection) {
|
|
1287
1287
|
const iconLeft = x + (cellWidth - 16) / 2;
|
|
1288
1288
|
const iconTop = y + (cellHeight - 16) / 2;
|
|
1289
1289
|
ctx.fillStyle = isAxisSelected ? colors.axisSelectionText : colors.icon;
|
|
@@ -1874,6 +1874,7 @@ function TableInner({
|
|
|
1874
1874
|
onColumnsReorder,
|
|
1875
1875
|
onColumnResize,
|
|
1876
1876
|
rowDraggable = false,
|
|
1877
|
+
combineRowSelectionAndDrag = false,
|
|
1877
1878
|
utilityColumnOrder = ["drag", "selection", "rowNumber"],
|
|
1878
1879
|
onRowsReorder,
|
|
1879
1880
|
onInsertRows,
|
|
@@ -1942,6 +1943,7 @@ function TableInner({
|
|
|
1942
1943
|
const showRowCheckbox = Boolean(rowSelection) && (typeof rowSelection !== "object" || rowSelection.showCheckbox !== false);
|
|
1943
1944
|
const rowSelectionIndicator = typeof rowSelection === "object" ? rowSelection.indicator ?? "checkbox" : "checkbox";
|
|
1944
1945
|
const rowSelectionColumnWidth = typeof rowSelection === "object" ? Math.max(24, rowSelection.columnWidth ?? 44) : 44;
|
|
1946
|
+
const hasCombinedRowUtility = combineRowSelectionAndDrag && rowDraggable && showRowCheckbox;
|
|
1945
1947
|
(0, import_react8.useEffect)(() => {
|
|
1946
1948
|
if (!isProductionRuntime() && hasNestedFixedColumns(sourceColumns)) {
|
|
1947
1949
|
console.warn("[Table] Multi-level headers only support fixed columns on top-level columns. Nested fixed values are ignored.");
|
|
@@ -1949,8 +1951,22 @@ function TableInner({
|
|
|
1949
1951
|
}, [sourceColumns]);
|
|
1950
1952
|
const columns = (0, import_react8.useMemo)(() => {
|
|
1951
1953
|
const utilityColumns = [];
|
|
1954
|
+
let combinedRowUtilityAdded = false;
|
|
1952
1955
|
utilityColumnOrder.forEach((utilityColumn) => {
|
|
1953
|
-
if (utilityColumn === "drag"
|
|
1956
|
+
if (hasCombinedRowUtility && (utilityColumn === "drag" || utilityColumn === "selection")) {
|
|
1957
|
+
if (combinedRowUtilityAdded) return;
|
|
1958
|
+
combinedRowUtilityAdded = true;
|
|
1959
|
+
utilityColumns.push({
|
|
1960
|
+
key: "__rvg_row_selection_drag__",
|
|
1961
|
+
title: "",
|
|
1962
|
+
width: rowSelectionColumnWidth,
|
|
1963
|
+
align: "center",
|
|
1964
|
+
fixed: "left",
|
|
1965
|
+
rowSelection: true,
|
|
1966
|
+
rowSelectionIndicator,
|
|
1967
|
+
rowDragHandle: true
|
|
1968
|
+
});
|
|
1969
|
+
} else if (utilityColumn === "drag" && rowDraggable) {
|
|
1954
1970
|
utilityColumns.push({ key: "__rvg_row_drag__", title: "", width: 36, align: "center", fixed: "left", rowDragHandle: true });
|
|
1955
1971
|
} else if (utilityColumn === "selection" && showRowCheckbox) {
|
|
1956
1972
|
utilityColumns.push({ key: "__rvg_row_selection__", title: "", width: rowSelectionColumnWidth, align: "center", fixed: "left", rowSelection: true, rowSelectionIndicator });
|
|
@@ -1963,8 +1979,8 @@ function TableInner({
|
|
|
1963
1979
|
return resizedWidth === void 0 ? column : { ...column, width: resizedWidth };
|
|
1964
1980
|
});
|
|
1965
1981
|
return [...utilityColumns, ...dataColumns];
|
|
1966
|
-
}, [leafSourceColumns, resizedColumnWidths, rowDraggable, rowNumber, rowSelectionColumnWidth, rowSelectionIndicator, showRowCheckbox, sourceRows.length, utilityColumnOrder]);
|
|
1967
|
-
const utilityColumnCount = (rowDraggable ? 1 : 0) + (showRowCheckbox ? 1 : 0) + (rowNumber ? 1 : 0);
|
|
1982
|
+
}, [hasCombinedRowUtility, leafSourceColumns, resizedColumnWidths, rowDraggable, rowNumber, rowSelectionColumnWidth, rowSelectionIndicator, showRowCheckbox, sourceRows.length, utilityColumnOrder]);
|
|
1983
|
+
const utilityColumnCount = (hasCombinedRowUtility ? 1 : (rowDraggable ? 1 : 0) + (showRowCheckbox ? 1 : 0)) + (rowNumber ? 1 : 0);
|
|
1968
1984
|
const headerCells = (0, import_react8.useMemo)(() => buildHeaderCells(sourceColumns, utilityColumnCount, headerDepth), [headerDepth, sourceColumns, utilityColumnCount]);
|
|
1969
1985
|
const activeCustomHeaderLevels = (0, import_react8.useMemo)(() => {
|
|
1970
1986
|
const levels = /* @__PURE__ */ new Map();
|
|
@@ -2858,7 +2874,7 @@ function TableInner({
|
|
|
2858
2874
|
verticalTrack.style.display = "none";
|
|
2859
2875
|
} else {
|
|
2860
2876
|
const top = fixedHeader ? bodyTop : 0;
|
|
2861
|
-
const bottom = bottomSummaryHeight;
|
|
2877
|
+
const bottom = bottomSummaryHeight + 2;
|
|
2862
2878
|
const trackHeight = Math.max(0, effectiveHeight - top - bottom);
|
|
2863
2879
|
if (trackHeight <= 0) {
|
|
2864
2880
|
verticalTrack.style.display = "none";
|
|
@@ -3320,13 +3336,15 @@ function TableInner({
|
|
|
3320
3336
|
cell.style.left = `${left}px`;
|
|
3321
3337
|
cell.style.width = `${columnWidth}px`;
|
|
3322
3338
|
cell.style.justifyContent = column.align === "right" ? "flex-end" : column.align === "center" ? "center" : "flex-start";
|
|
3323
|
-
if (column.rowDragHandle) {
|
|
3339
|
+
if (column.rowDragHandle && !column.rowSelection) {
|
|
3324
3340
|
cell.appendChild(createRowDragHandleSvg());
|
|
3325
3341
|
} else if (column.rowSelection) {
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3342
|
+
if (column.rowSelectionIndicator !== "none") {
|
|
3343
|
+
const checkbox = document.createElement("span");
|
|
3344
|
+
checkbox.className = selectedRowKeySet.has(rowKey2) ? "rvg-preview-checkbox is-checked" : "rvg-preview-checkbox";
|
|
3345
|
+
checkbox.textContent = selectedRowKeySet.has(rowKey2) ? "\u2713" : "";
|
|
3346
|
+
cell.appendChild(checkbox);
|
|
3347
|
+
}
|
|
3330
3348
|
} else {
|
|
3331
3349
|
cell.textContent = getCellLabel(sourceIndex, columnIndex);
|
|
3332
3350
|
}
|
|
@@ -3751,6 +3769,9 @@ function TableInner({
|
|
|
3751
3769
|
const metric = metrics[editing.columnIndex];
|
|
3752
3770
|
const column = columns[editing.columnIndex];
|
|
3753
3771
|
if (!metric || !column) return void 0;
|
|
3772
|
+
const row = rows[editing.rowIndex];
|
|
3773
|
+
const cellValue = column.dataIndex === void 0 ? void 0 : row?.[column.dataIndex];
|
|
3774
|
+
const backgroundColor = row ? column.cellStyle?.(cellValue, row, editing.rowIndex).backgroundColor ?? rowStyle?.(row, editing.rowIndex).backgroundColor : void 0;
|
|
3754
3775
|
const fixedSide = column.fixed;
|
|
3755
3776
|
const span = getCellSpan(editing.rowIndex, editing.columnIndex);
|
|
3756
3777
|
const cellWidth = getCellDisplayWidth(editing.columnIndex, span?.colSpan ?? 1);
|
|
@@ -3769,7 +3790,8 @@ function TableInner({
|
|
|
3769
3790
|
left: visibleLeft,
|
|
3770
3791
|
top: visibleTop,
|
|
3771
3792
|
width: Math.max(0, visibleRight - visibleLeft),
|
|
3772
|
-
height: Math.max(0, visibleBottom - visibleTop)
|
|
3793
|
+
height: Math.max(0, visibleBottom - visibleTop),
|
|
3794
|
+
backgroundColor
|
|
3773
3795
|
};
|
|
3774
3796
|
}
|
|
3775
3797
|
return {
|
|
@@ -3778,9 +3800,10 @@ function TableInner({
|
|
|
3778
3800
|
width: cellWidth,
|
|
3779
3801
|
height: cellHeight,
|
|
3780
3802
|
textAlign: column.align ?? "left",
|
|
3803
|
+
backgroundColor,
|
|
3781
3804
|
clipPath: `inset(${Math.max(0, visibleTop - cellTop)}px ${Math.max(0, cellLeft + cellWidth - visibleRight)}px ${Math.max(0, cellTop + cellHeight - visibleBottom)}px ${Math.max(0, visibleLeft - cellLeft)}px)`
|
|
3782
3805
|
};
|
|
3783
|
-
}, [bodyTop, columns, editing, fixedHeader, fixedWidth, getCellDisplayWidth, getCellSpan, getScrollableColumnLeft, leftFixedOffsets, metrics, renderHeight, rightFixedOffsets, rightFixedWidth, rowHeight, viewport.width]);
|
|
3806
|
+
}, [bodyTop, columns, editing, fixedHeader, fixedWidth, getCellDisplayWidth, getCellSpan, getScrollableColumnLeft, leftFixedOffsets, metrics, renderHeight, rightFixedOffsets, rightFixedWidth, rowHeight, rows, rowStyle, viewport.width]);
|
|
3784
3807
|
const handleColumnPointerDown = (0, import_react8.useCallback)((event) => {
|
|
3785
3808
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
3786
3809
|
const localY = event.clientY - rect.top;
|
|
@@ -5011,9 +5034,7 @@ function TableInner({
|
|
|
5011
5034
|
handleColumnPointerDown(event);
|
|
5012
5035
|
if (columnDragRef.current) return;
|
|
5013
5036
|
const headerDragCell = columnDraggable ? locateHeaderCell(event.clientX, event.clientY) : null;
|
|
5014
|
-
|
|
5015
|
-
const rowDragHandle = rowDraggable && columnIndex >= 0 && Boolean(columns[columnIndex].rowDragHandle) && locateRow(event.clientY) >= 0;
|
|
5016
|
-
if (headerDragCell && locateHeaderCellDragHandle(event.clientX, event.clientY, headerDragCell) || rowDragHandle) {
|
|
5037
|
+
if (headerDragCell && locateHeaderCellDragHandle(event.clientX, event.clientY, headerDragCell)) {
|
|
5017
5038
|
hideDragTooltips();
|
|
5018
5039
|
document.documentElement.classList.add("rvg-is-dragging");
|
|
5019
5040
|
event.currentTarget.style.cursor = "move";
|
|
@@ -5087,7 +5108,7 @@ function TableInner({
|
|
|
5087
5108
|
setSelection(null);
|
|
5088
5109
|
return;
|
|
5089
5110
|
}
|
|
5090
|
-
if (columns[cell.columnIndex].rowDragHandle || columns[cell.columnIndex].rowNumber) {
|
|
5111
|
+
if (columns[cell.columnIndex].rowDragHandle && !columns[cell.columnIndex].rowSelection || columns[cell.columnIndex].rowNumber) {
|
|
5091
5112
|
clickedCellRef.current = null;
|
|
5092
5113
|
return;
|
|
5093
5114
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -421,6 +421,8 @@ interface TableProps<Row extends object> {
|
|
|
421
421
|
}) => void;
|
|
422
422
|
onColumnResize?: (columnKey: string, width: number) => void;
|
|
423
423
|
rowDraggable?: boolean;
|
|
424
|
+
/** Merge row selection and row dragging into one utility column. Click selects; press and drag reorders. */
|
|
425
|
+
combineRowSelectionAndDrag?: boolean;
|
|
424
426
|
/** Order of the generated row utility columns. Defaults to drag, selection, then row number. */
|
|
425
427
|
utilityColumnOrder?: Array<'drag' | 'selection' | 'rowNumber'>;
|
|
426
428
|
onRowsReorder?: (rows: Row[], detail: {
|
package/dist/index.d.ts
CHANGED
|
@@ -421,6 +421,8 @@ interface TableProps<Row extends object> {
|
|
|
421
421
|
}) => void;
|
|
422
422
|
onColumnResize?: (columnKey: string, width: number) => void;
|
|
423
423
|
rowDraggable?: boolean;
|
|
424
|
+
/** Merge row selection and row dragging into one utility column. Click selects; press and drag reorders. */
|
|
425
|
+
combineRowSelectionAndDrag?: boolean;
|
|
424
426
|
/** Order of the generated row utility columns. Defaults to drag, selection, then row number. */
|
|
425
427
|
utilityColumnOrder?: Array<'drag' | 'selection' | 'rowNumber'>;
|
|
426
428
|
onRowsReorder?: (rows: Row[], detail: {
|
package/dist/index.js
CHANGED
|
@@ -960,8 +960,8 @@ function getVisibleHeaderActions(column, width, columnDraggable = false, titleWi
|
|
|
960
960
|
return { filter: visible.has("filter"), sort: visible.has("sort"), drag: visible.has("drag") };
|
|
961
961
|
}
|
|
962
962
|
function getMinimumColumnWidth(column, columnDraggable = false) {
|
|
963
|
-
if (column.rowDragHandle) return 36;
|
|
964
963
|
if (column.rowSelection) return Math.max(24, column.width ?? 44);
|
|
964
|
+
if (column.rowDragHandle) return 36;
|
|
965
965
|
if (column.rowNumber) return 44;
|
|
966
966
|
return 60;
|
|
967
967
|
}
|
|
@@ -1253,7 +1253,7 @@ function paintGrid(options) {
|
|
|
1253
1253
|
if (columnIndex === rangeColumnStart) ctx.fillRect(x, y, 2, cellHeight);
|
|
1254
1254
|
if (columnIndex === rangeColumnEnd) ctx.fillRect(x + cellWidth - 2, y, 2, cellHeight);
|
|
1255
1255
|
}
|
|
1256
|
-
if (column.rowDragHandle) {
|
|
1256
|
+
if (column.rowDragHandle && !column.rowSelection) {
|
|
1257
1257
|
const iconLeft = x + (cellWidth - 16) / 2;
|
|
1258
1258
|
const iconTop = y + (cellHeight - 16) / 2;
|
|
1259
1259
|
ctx.fillStyle = isAxisSelected ? colors.axisSelectionText : colors.icon;
|
|
@@ -1844,6 +1844,7 @@ function TableInner({
|
|
|
1844
1844
|
onColumnsReorder,
|
|
1845
1845
|
onColumnResize,
|
|
1846
1846
|
rowDraggable = false,
|
|
1847
|
+
combineRowSelectionAndDrag = false,
|
|
1847
1848
|
utilityColumnOrder = ["drag", "selection", "rowNumber"],
|
|
1848
1849
|
onRowsReorder,
|
|
1849
1850
|
onInsertRows,
|
|
@@ -1912,6 +1913,7 @@ function TableInner({
|
|
|
1912
1913
|
const showRowCheckbox = Boolean(rowSelection) && (typeof rowSelection !== "object" || rowSelection.showCheckbox !== false);
|
|
1913
1914
|
const rowSelectionIndicator = typeof rowSelection === "object" ? rowSelection.indicator ?? "checkbox" : "checkbox";
|
|
1914
1915
|
const rowSelectionColumnWidth = typeof rowSelection === "object" ? Math.max(24, rowSelection.columnWidth ?? 44) : 44;
|
|
1916
|
+
const hasCombinedRowUtility = combineRowSelectionAndDrag && rowDraggable && showRowCheckbox;
|
|
1915
1917
|
useEffect3(() => {
|
|
1916
1918
|
if (!isProductionRuntime() && hasNestedFixedColumns(sourceColumns)) {
|
|
1917
1919
|
console.warn("[Table] Multi-level headers only support fixed columns on top-level columns. Nested fixed values are ignored.");
|
|
@@ -1919,8 +1921,22 @@ function TableInner({
|
|
|
1919
1921
|
}, [sourceColumns]);
|
|
1920
1922
|
const columns = useMemo2(() => {
|
|
1921
1923
|
const utilityColumns = [];
|
|
1924
|
+
let combinedRowUtilityAdded = false;
|
|
1922
1925
|
utilityColumnOrder.forEach((utilityColumn) => {
|
|
1923
|
-
if (utilityColumn === "drag"
|
|
1926
|
+
if (hasCombinedRowUtility && (utilityColumn === "drag" || utilityColumn === "selection")) {
|
|
1927
|
+
if (combinedRowUtilityAdded) return;
|
|
1928
|
+
combinedRowUtilityAdded = true;
|
|
1929
|
+
utilityColumns.push({
|
|
1930
|
+
key: "__rvg_row_selection_drag__",
|
|
1931
|
+
title: "",
|
|
1932
|
+
width: rowSelectionColumnWidth,
|
|
1933
|
+
align: "center",
|
|
1934
|
+
fixed: "left",
|
|
1935
|
+
rowSelection: true,
|
|
1936
|
+
rowSelectionIndicator,
|
|
1937
|
+
rowDragHandle: true
|
|
1938
|
+
});
|
|
1939
|
+
} else if (utilityColumn === "drag" && rowDraggable) {
|
|
1924
1940
|
utilityColumns.push({ key: "__rvg_row_drag__", title: "", width: 36, align: "center", fixed: "left", rowDragHandle: true });
|
|
1925
1941
|
} else if (utilityColumn === "selection" && showRowCheckbox) {
|
|
1926
1942
|
utilityColumns.push({ key: "__rvg_row_selection__", title: "", width: rowSelectionColumnWidth, align: "center", fixed: "left", rowSelection: true, rowSelectionIndicator });
|
|
@@ -1933,8 +1949,8 @@ function TableInner({
|
|
|
1933
1949
|
return resizedWidth === void 0 ? column : { ...column, width: resizedWidth };
|
|
1934
1950
|
});
|
|
1935
1951
|
return [...utilityColumns, ...dataColumns];
|
|
1936
|
-
}, [leafSourceColumns, resizedColumnWidths, rowDraggable, rowNumber, rowSelectionColumnWidth, rowSelectionIndicator, showRowCheckbox, sourceRows.length, utilityColumnOrder]);
|
|
1937
|
-
const utilityColumnCount = (rowDraggable ? 1 : 0) + (showRowCheckbox ? 1 : 0) + (rowNumber ? 1 : 0);
|
|
1952
|
+
}, [hasCombinedRowUtility, leafSourceColumns, resizedColumnWidths, rowDraggable, rowNumber, rowSelectionColumnWidth, rowSelectionIndicator, showRowCheckbox, sourceRows.length, utilityColumnOrder]);
|
|
1953
|
+
const utilityColumnCount = (hasCombinedRowUtility ? 1 : (rowDraggable ? 1 : 0) + (showRowCheckbox ? 1 : 0)) + (rowNumber ? 1 : 0);
|
|
1938
1954
|
const headerCells = useMemo2(() => buildHeaderCells(sourceColumns, utilityColumnCount, headerDepth), [headerDepth, sourceColumns, utilityColumnCount]);
|
|
1939
1955
|
const activeCustomHeaderLevels = useMemo2(() => {
|
|
1940
1956
|
const levels = /* @__PURE__ */ new Map();
|
|
@@ -2828,7 +2844,7 @@ function TableInner({
|
|
|
2828
2844
|
verticalTrack.style.display = "none";
|
|
2829
2845
|
} else {
|
|
2830
2846
|
const top = fixedHeader ? bodyTop : 0;
|
|
2831
|
-
const bottom = bottomSummaryHeight;
|
|
2847
|
+
const bottom = bottomSummaryHeight + 2;
|
|
2832
2848
|
const trackHeight = Math.max(0, effectiveHeight - top - bottom);
|
|
2833
2849
|
if (trackHeight <= 0) {
|
|
2834
2850
|
verticalTrack.style.display = "none";
|
|
@@ -3290,13 +3306,15 @@ function TableInner({
|
|
|
3290
3306
|
cell.style.left = `${left}px`;
|
|
3291
3307
|
cell.style.width = `${columnWidth}px`;
|
|
3292
3308
|
cell.style.justifyContent = column.align === "right" ? "flex-end" : column.align === "center" ? "center" : "flex-start";
|
|
3293
|
-
if (column.rowDragHandle) {
|
|
3309
|
+
if (column.rowDragHandle && !column.rowSelection) {
|
|
3294
3310
|
cell.appendChild(createRowDragHandleSvg());
|
|
3295
3311
|
} else if (column.rowSelection) {
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3312
|
+
if (column.rowSelectionIndicator !== "none") {
|
|
3313
|
+
const checkbox = document.createElement("span");
|
|
3314
|
+
checkbox.className = selectedRowKeySet.has(rowKey2) ? "rvg-preview-checkbox is-checked" : "rvg-preview-checkbox";
|
|
3315
|
+
checkbox.textContent = selectedRowKeySet.has(rowKey2) ? "\u2713" : "";
|
|
3316
|
+
cell.appendChild(checkbox);
|
|
3317
|
+
}
|
|
3300
3318
|
} else {
|
|
3301
3319
|
cell.textContent = getCellLabel(sourceIndex, columnIndex);
|
|
3302
3320
|
}
|
|
@@ -3721,6 +3739,9 @@ function TableInner({
|
|
|
3721
3739
|
const metric = metrics[editing.columnIndex];
|
|
3722
3740
|
const column = columns[editing.columnIndex];
|
|
3723
3741
|
if (!metric || !column) return void 0;
|
|
3742
|
+
const row = rows[editing.rowIndex];
|
|
3743
|
+
const cellValue = column.dataIndex === void 0 ? void 0 : row?.[column.dataIndex];
|
|
3744
|
+
const backgroundColor = row ? column.cellStyle?.(cellValue, row, editing.rowIndex).backgroundColor ?? rowStyle?.(row, editing.rowIndex).backgroundColor : void 0;
|
|
3724
3745
|
const fixedSide = column.fixed;
|
|
3725
3746
|
const span = getCellSpan(editing.rowIndex, editing.columnIndex);
|
|
3726
3747
|
const cellWidth = getCellDisplayWidth(editing.columnIndex, span?.colSpan ?? 1);
|
|
@@ -3739,7 +3760,8 @@ function TableInner({
|
|
|
3739
3760
|
left: visibleLeft,
|
|
3740
3761
|
top: visibleTop,
|
|
3741
3762
|
width: Math.max(0, visibleRight - visibleLeft),
|
|
3742
|
-
height: Math.max(0, visibleBottom - visibleTop)
|
|
3763
|
+
height: Math.max(0, visibleBottom - visibleTop),
|
|
3764
|
+
backgroundColor
|
|
3743
3765
|
};
|
|
3744
3766
|
}
|
|
3745
3767
|
return {
|
|
@@ -3748,9 +3770,10 @@ function TableInner({
|
|
|
3748
3770
|
width: cellWidth,
|
|
3749
3771
|
height: cellHeight,
|
|
3750
3772
|
textAlign: column.align ?? "left",
|
|
3773
|
+
backgroundColor,
|
|
3751
3774
|
clipPath: `inset(${Math.max(0, visibleTop - cellTop)}px ${Math.max(0, cellLeft + cellWidth - visibleRight)}px ${Math.max(0, cellTop + cellHeight - visibleBottom)}px ${Math.max(0, visibleLeft - cellLeft)}px)`
|
|
3752
3775
|
};
|
|
3753
|
-
}, [bodyTop, columns, editing, fixedHeader, fixedWidth, getCellDisplayWidth, getCellSpan, getScrollableColumnLeft, leftFixedOffsets, metrics, renderHeight, rightFixedOffsets, rightFixedWidth, rowHeight, viewport.width]);
|
|
3776
|
+
}, [bodyTop, columns, editing, fixedHeader, fixedWidth, getCellDisplayWidth, getCellSpan, getScrollableColumnLeft, leftFixedOffsets, metrics, renderHeight, rightFixedOffsets, rightFixedWidth, rowHeight, rows, rowStyle, viewport.width]);
|
|
3754
3777
|
const handleColumnPointerDown = useCallback2((event) => {
|
|
3755
3778
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
3756
3779
|
const localY = event.clientY - rect.top;
|
|
@@ -4981,9 +5004,7 @@ function TableInner({
|
|
|
4981
5004
|
handleColumnPointerDown(event);
|
|
4982
5005
|
if (columnDragRef.current) return;
|
|
4983
5006
|
const headerDragCell = columnDraggable ? locateHeaderCell(event.clientX, event.clientY) : null;
|
|
4984
|
-
|
|
4985
|
-
const rowDragHandle = rowDraggable && columnIndex >= 0 && Boolean(columns[columnIndex].rowDragHandle) && locateRow(event.clientY) >= 0;
|
|
4986
|
-
if (headerDragCell && locateHeaderCellDragHandle(event.clientX, event.clientY, headerDragCell) || rowDragHandle) {
|
|
5007
|
+
if (headerDragCell && locateHeaderCellDragHandle(event.clientX, event.clientY, headerDragCell)) {
|
|
4987
5008
|
hideDragTooltips();
|
|
4988
5009
|
document.documentElement.classList.add("rvg-is-dragging");
|
|
4989
5010
|
event.currentTarget.style.cursor = "move";
|
|
@@ -5057,7 +5078,7 @@ function TableInner({
|
|
|
5057
5078
|
setSelection(null);
|
|
5058
5079
|
return;
|
|
5059
5080
|
}
|
|
5060
|
-
if (columns[cell.columnIndex].rowDragHandle || columns[cell.columnIndex].rowNumber) {
|
|
5081
|
+
if (columns[cell.columnIndex].rowDragHandle && !columns[cell.columnIndex].rowSelection || columns[cell.columnIndex].rowNumber) {
|
|
5061
5082
|
clickedCellRef.current = null;
|
|
5062
5083
|
return;
|
|
5063
5084
|
}
|