@lensui/lens-table 0.1.21 → 0.1.22
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 +31 -20
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +31 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -841,6 +841,7 @@ function getMinimumColumnWidth(column, columnDraggable = false) {
|
|
|
841
841
|
function buildColumnMetrics(columns, columnDraggableOrOptions = false) {
|
|
842
842
|
const options = typeof columnDraggableOrOptions === "boolean" ? { columnDraggable: columnDraggableOrOptions } : columnDraggableOrOptions;
|
|
843
843
|
const columnDraggable = options.columnDraggable ?? false;
|
|
844
|
+
const stretchExcludedIndices = options.stretchExcludedIndices ?? /* @__PURE__ */ new Set();
|
|
844
845
|
let left = 0;
|
|
845
846
|
const metrics = columns.map((column) => {
|
|
846
847
|
const width = Math.max(getMinimumColumnWidth(column, columnDraggable), column.width ?? DEFAULT_COLUMN_WIDTH);
|
|
@@ -850,9 +851,10 @@ function buildColumnMetrics(columns, columnDraggableOrOptions = false) {
|
|
|
850
851
|
});
|
|
851
852
|
const viewportWidth = options.viewportWidth ?? 0;
|
|
852
853
|
if (viewportWidth <= left || columns.length === 0) return metrics;
|
|
853
|
-
const unsetWidthStretchable = columns.map((column, index) => ({ column, index })).filter(({ column }) => column.width === void 0 && column.fixed === void 0 && !column.rowSelection && !column.rowDragHandle && !column.rowNumber);
|
|
854
|
-
const
|
|
855
|
-
const
|
|
854
|
+
const unsetWidthStretchable = columns.map((column, index) => ({ column, index })).filter(({ column, index }) => !stretchExcludedIndices.has(index) && column.width === void 0 && column.fixed === void 0 && !column.rowSelection && !column.rowDragHandle && !column.rowNumber);
|
|
855
|
+
const allDataStretchable = columns.map((column, index) => ({ column, index })).filter(({ column }) => column.fixed === void 0 && !column.rowSelection && !column.rowDragHandle && !column.rowNumber);
|
|
856
|
+
const dataStretchable = allDataStretchable.filter(({ index }) => !stretchExcludedIndices.has(index));
|
|
857
|
+
const targets = unsetWidthStretchable.length > 0 ? unsetWidthStretchable : dataStretchable.length > 0 ? dataStretchable : allDataStretchable.slice(-1);
|
|
856
858
|
if (targets.length === 0) return metrics;
|
|
857
859
|
const extra = viewportWidth - left;
|
|
858
860
|
const baseTotal = targets.reduce((sum, { index }) => sum + metrics[index].width, 0);
|
|
@@ -1448,6 +1450,13 @@ function useControllableValue(value, defaultValue, onChange) {
|
|
|
1448
1450
|
|
|
1449
1451
|
// src/Table.tsx
|
|
1450
1452
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1453
|
+
function resolveColumnDropIndex(sourceIndex, targetIndex, edge, columnCount) {
|
|
1454
|
+
const insertionIndex = targetIndex + (edge === "right" ? 1 : 0) - (sourceIndex < targetIndex ? 1 : 0);
|
|
1455
|
+
return Math.max(0, Math.min(columnCount - 1, insertionIndex));
|
|
1456
|
+
}
|
|
1457
|
+
function resolveColumnDropPlacement(edge) {
|
|
1458
|
+
return edge === "right" ? "after" : "before";
|
|
1459
|
+
}
|
|
1451
1460
|
var ANNOTATION_COLORS = ["#f44336", "#ff7a45", "#f5a623", "#f2c94c", "#52c41a", "#13a8a8", "#1677ff", "#597ef7", "#9254de", "#eb2f96"];
|
|
1452
1461
|
var FALLBACK_HEIGHT = 480;
|
|
1453
1462
|
var EMPTY_BODY_HEIGHT = 240;
|
|
@@ -1719,6 +1728,7 @@ function TableInner({
|
|
|
1719
1728
|
const contextMenuEnabled = contextMenuConfig !== false;
|
|
1720
1729
|
const customContextMenuConfig = typeof contextMenuConfig === "object" ? contextMenuConfig : void 0;
|
|
1721
1730
|
const [resizedColumnWidths, setResizedColumnWidths] = (0, import_react5.useState)({});
|
|
1731
|
+
const [manuallyResizedColumnKeys, setManuallyResizedColumnKeys] = (0, import_react5.useState)(() => /* @__PURE__ */ new Set());
|
|
1722
1732
|
const leafSourceColumns = (0, import_react5.useMemo)(() => flattenDataColumns(sourceColumns), [sourceColumns]);
|
|
1723
1733
|
const sourceColumnWidthsRef = (0, import_react5.useRef)(new Map(leafSourceColumns.map((column) => [column.key, column.width])));
|
|
1724
1734
|
const showRowCheckbox = Boolean(rowSelection) && (typeof rowSelection !== "object" || rowSelection.showCheckbox !== false);
|
|
@@ -1840,6 +1850,10 @@ function TableInner({
|
|
|
1840
1850
|
const previousSourceWidths = sourceColumnWidthsRef.current;
|
|
1841
1851
|
const nextSourceWidths = new Map(leafSourceColumns.map((column) => [column.key, column.width]));
|
|
1842
1852
|
sourceColumnWidthsRef.current = nextSourceWidths;
|
|
1853
|
+
setManuallyResizedColumnKeys((current) => {
|
|
1854
|
+
const next = new Set([...current].filter((key) => nextSourceWidths.has(key) && previousSourceWidths.get(key) === nextSourceWidths.get(key)));
|
|
1855
|
+
return next.size === current.size ? current : next;
|
|
1856
|
+
});
|
|
1843
1857
|
setResizedColumnWidths((current) => {
|
|
1844
1858
|
const sourceColumnByKey = new Map(leafSourceColumns.map((column) => [column.key, column]));
|
|
1845
1859
|
let changed = false;
|
|
@@ -2101,11 +2115,14 @@ function TableInner({
|
|
|
2101
2115
|
if (selection?.rowKey === editing.rowKey && selection.columnKey === editing.columnKey) return;
|
|
2102
2116
|
setEditing(null);
|
|
2103
2117
|
}, [editing, selection]);
|
|
2104
|
-
const
|
|
2118
|
+
const stretchExcludedIndices = (0, import_react5.useMemo)(() => new Set(
|
|
2119
|
+
columns.flatMap((column, index) => manuallyResizedColumnKeys.has(column.key) ? [index] : [])
|
|
2120
|
+
), [columns, manuallyResizedColumnKeys]);
|
|
2105
2121
|
const metrics = (0, import_react5.useMemo)(() => buildColumnMetrics(columns, {
|
|
2106
2122
|
columnDraggable,
|
|
2107
|
-
viewportWidth:
|
|
2108
|
-
|
|
2123
|
+
viewportWidth: viewport.width,
|
|
2124
|
+
stretchExcludedIndices
|
|
2125
|
+
}), [columnDraggable, columns, stretchExcludedIndices, viewport.width]);
|
|
2109
2126
|
const contentWidth = metrics.length > 0 ? metrics[metrics.length - 1].right : 0;
|
|
2110
2127
|
const contentHeight = rows.length * rowHeight;
|
|
2111
2128
|
const fixedWidth = (0, import_react5.useMemo)(() => columns.reduce((width2, column, index) => column.fixed === "left" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
|
|
@@ -2890,6 +2907,7 @@ function TableInner({
|
|
|
2890
2907
|
return headerDepth - 1;
|
|
2891
2908
|
}, [headerDepth, headerRowHeights, headerRowOffsets]);
|
|
2892
2909
|
const resizeColumn = (0, import_react5.useCallback)((columnKey, width2) => {
|
|
2910
|
+
setManuallyResizedColumnKeys((current) => current.has(columnKey) ? current : new Set(current).add(columnKey));
|
|
2893
2911
|
setResizedColumnWidths((current) => current[columnKey] === width2 ? current : { ...current, [columnKey]: width2 });
|
|
2894
2912
|
onColumnResize?.(columnKey, width2);
|
|
2895
2913
|
}, [onColumnResize]);
|
|
@@ -3035,15 +3053,7 @@ function TableInner({
|
|
|
3035
3053
|
(0, import_react5.useEffect)(() => {
|
|
3036
3054
|
const canvas = canvasRef.current;
|
|
3037
3055
|
if (!canvas || !columnDraggable && !rowDraggable) return;
|
|
3038
|
-
const getColumnDropIndex = (sourceIndex, targetIndex, edge) =>
|
|
3039
|
-
if (edge === "right") return targetIndex;
|
|
3040
|
-
const destinationIndex = targetIndex - (sourceIndex < targetIndex ? 1 : 0);
|
|
3041
|
-
return Math.max(0, Math.min(columns.length - 1, destinationIndex));
|
|
3042
|
-
};
|
|
3043
|
-
const getColumnDropPlacement = (sourceIndex, targetIndex, edge) => {
|
|
3044
|
-
if (edge !== "right") return "before";
|
|
3045
|
-
return targetIndex < sourceIndex ? "before" : "after";
|
|
3046
|
-
};
|
|
3056
|
+
const getColumnDropIndex = (sourceIndex, targetIndex, edge) => resolveColumnDropIndex(sourceIndex, targetIndex, edge, columns.length);
|
|
3047
3057
|
const getHeaderColumn = (clientX, clientY) => {
|
|
3048
3058
|
const rect = canvas.getBoundingClientRect();
|
|
3049
3059
|
const headerY = fixedHeader ? 0 : -scrollRef.current.top;
|
|
@@ -3053,8 +3063,9 @@ function TableInner({
|
|
|
3053
3063
|
};
|
|
3054
3064
|
const getHeaderDragCell = (clientX, clientY) => {
|
|
3055
3065
|
const cell = locateHeaderCell(clientX, clientY);
|
|
3056
|
-
if (!cell) return null;
|
|
3057
|
-
|
|
3066
|
+
if (!cell || locateHeaderResizeCell(clientX, clientY)) return null;
|
|
3067
|
+
if (cell.leaf && locateHeaderAction(clientX, cell.startIndex)) return null;
|
|
3068
|
+
return cell;
|
|
3058
3069
|
};
|
|
3059
3070
|
const cleanupDrag = (0, import_adapter.draggable)({
|
|
3060
3071
|
element: canvas,
|
|
@@ -3315,7 +3326,7 @@ function TableInner({
|
|
|
3315
3326
|
sourceKey: String(source.data.sourceKey),
|
|
3316
3327
|
targetKey: validDrop.targetKey,
|
|
3317
3328
|
parentKey: validDrop.parentKey,
|
|
3318
|
-
placement:
|
|
3329
|
+
placement: resolveColumnDropPlacement(validDrop.columnEdge)
|
|
3319
3330
|
}
|
|
3320
3331
|
);
|
|
3321
3332
|
}
|
|
@@ -3370,7 +3381,7 @@ function TableInner({
|
|
|
3370
3381
|
cleanupDrag();
|
|
3371
3382
|
cleanupDrop();
|
|
3372
3383
|
};
|
|
3373
|
-
}, [applyColumnOrder, applyRowOrder, bodyTop, columnDraggable, columns, filterValues, fixedHeader, getCellLabel, getDisplayedColumnLeft, getHeaderCellWidth, getRowKey, headerActionSize, headerActionSlotWidth, headerCells, headerHeight, hideDragTooltips, locateColumn,
|
|
3384
|
+
}, [applyColumnOrder, applyRowOrder, bodyTop, columnDraggable, columns, filterValues, fixedHeader, getCellLabel, getDisplayedColumnLeft, getHeaderCellWidth, getRowKey, headerActionSize, headerActionSlotWidth, headerCells, headerHeight, hideDragTooltips, locateColumn, locateHeaderAction, locateHeaderCell, locateHeaderResizeCell, locateRow, measureHeaderTitleWidth, metrics, rowDraggable, rowHeight, rows, selectedRowKeySet, selection, setDragGuide, setRowDragGuide, sortState, utilityColumnCount]);
|
|
3374
3385
|
const locateCell = (0, import_react5.useCallback)((clientX, clientY) => {
|
|
3375
3386
|
const canvas = canvasRef.current;
|
|
3376
3387
|
if (!canvas) return null;
|
|
@@ -3826,7 +3837,7 @@ function TableInner({
|
|
|
3826
3837
|
const isAxisSelected = selectedColumnKeySet.has(column.key);
|
|
3827
3838
|
const selectedClassName = isAxisSelected ? " is-axis-selected" : "";
|
|
3828
3839
|
const hoveredColumnClassName = hoveredHeaderColumnIndex === columnIndex ? " is-header-hovered" : "";
|
|
3829
|
-
const top = headerLeafTop + (headerLeafHeight - headerActionSize) / 2;
|
|
3840
|
+
const top = column.renderHeader ? headerLeafTop + 8 + Math.max(0, (16 - headerActionSize) / 2) : headerLeafTop + (headerLeafHeight - headerActionSize) / 2;
|
|
3830
3841
|
const visibleActions = getVisibleHeaderActions(column, metrics[columnIndex].width, columnDraggable, measureHeaderTitleWidth(columnIndex), headerActionSlotWidth);
|
|
3831
3842
|
let right = left + metrics[columnIndex].width - (visibleActions.drag ? headerActionSlotWidth : 2);
|
|
3832
3843
|
const icons = [];
|
package/dist/index.d.cts
CHANGED
|
@@ -461,6 +461,8 @@ interface ColumnMetric {
|
|
|
461
461
|
interface BuildColumnMetricsOptions {
|
|
462
462
|
columnDraggable?: boolean;
|
|
463
463
|
viewportWidth?: number;
|
|
464
|
+
/** Columns whose manually resized widths must remain exact while spare width is distributed. */
|
|
465
|
+
stretchExcludedIndices?: ReadonlySet<number>;
|
|
464
466
|
}
|
|
465
467
|
/**
|
|
466
468
|
* Build cumulative column positions used by both canvas painting and DOM
|
package/dist/index.d.ts
CHANGED
|
@@ -461,6 +461,8 @@ interface ColumnMetric {
|
|
|
461
461
|
interface BuildColumnMetricsOptions {
|
|
462
462
|
columnDraggable?: boolean;
|
|
463
463
|
viewportWidth?: number;
|
|
464
|
+
/** Columns whose manually resized widths must remain exact while spare width is distributed. */
|
|
465
|
+
stretchExcludedIndices?: ReadonlySet<number>;
|
|
464
466
|
}
|
|
465
467
|
/**
|
|
466
468
|
* Build cumulative column positions used by both canvas painting and DOM
|
package/dist/index.js
CHANGED
|
@@ -811,6 +811,7 @@ function getMinimumColumnWidth(column, columnDraggable = false) {
|
|
|
811
811
|
function buildColumnMetrics(columns, columnDraggableOrOptions = false) {
|
|
812
812
|
const options = typeof columnDraggableOrOptions === "boolean" ? { columnDraggable: columnDraggableOrOptions } : columnDraggableOrOptions;
|
|
813
813
|
const columnDraggable = options.columnDraggable ?? false;
|
|
814
|
+
const stretchExcludedIndices = options.stretchExcludedIndices ?? /* @__PURE__ */ new Set();
|
|
814
815
|
let left = 0;
|
|
815
816
|
const metrics = columns.map((column) => {
|
|
816
817
|
const width = Math.max(getMinimumColumnWidth(column, columnDraggable), column.width ?? DEFAULT_COLUMN_WIDTH);
|
|
@@ -820,9 +821,10 @@ function buildColumnMetrics(columns, columnDraggableOrOptions = false) {
|
|
|
820
821
|
});
|
|
821
822
|
const viewportWidth = options.viewportWidth ?? 0;
|
|
822
823
|
if (viewportWidth <= left || columns.length === 0) return metrics;
|
|
823
|
-
const unsetWidthStretchable = columns.map((column, index) => ({ column, index })).filter(({ column }) => column.width === void 0 && column.fixed === void 0 && !column.rowSelection && !column.rowDragHandle && !column.rowNumber);
|
|
824
|
-
const
|
|
825
|
-
const
|
|
824
|
+
const unsetWidthStretchable = columns.map((column, index) => ({ column, index })).filter(({ column, index }) => !stretchExcludedIndices.has(index) && column.width === void 0 && column.fixed === void 0 && !column.rowSelection && !column.rowDragHandle && !column.rowNumber);
|
|
825
|
+
const allDataStretchable = columns.map((column, index) => ({ column, index })).filter(({ column }) => column.fixed === void 0 && !column.rowSelection && !column.rowDragHandle && !column.rowNumber);
|
|
826
|
+
const dataStretchable = allDataStretchable.filter(({ index }) => !stretchExcludedIndices.has(index));
|
|
827
|
+
const targets = unsetWidthStretchable.length > 0 ? unsetWidthStretchable : dataStretchable.length > 0 ? dataStretchable : allDataStretchable.slice(-1);
|
|
826
828
|
if (targets.length === 0) return metrics;
|
|
827
829
|
const extra = viewportWidth - left;
|
|
828
830
|
const baseTotal = targets.reduce((sum, { index }) => sum + metrics[index].width, 0);
|
|
@@ -1418,6 +1420,13 @@ function useControllableValue(value, defaultValue, onChange) {
|
|
|
1418
1420
|
|
|
1419
1421
|
// src/Table.tsx
|
|
1420
1422
|
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1423
|
+
function resolveColumnDropIndex(sourceIndex, targetIndex, edge, columnCount) {
|
|
1424
|
+
const insertionIndex = targetIndex + (edge === "right" ? 1 : 0) - (sourceIndex < targetIndex ? 1 : 0);
|
|
1425
|
+
return Math.max(0, Math.min(columnCount - 1, insertionIndex));
|
|
1426
|
+
}
|
|
1427
|
+
function resolveColumnDropPlacement(edge) {
|
|
1428
|
+
return edge === "right" ? "after" : "before";
|
|
1429
|
+
}
|
|
1421
1430
|
var ANNOTATION_COLORS = ["#f44336", "#ff7a45", "#f5a623", "#f2c94c", "#52c41a", "#13a8a8", "#1677ff", "#597ef7", "#9254de", "#eb2f96"];
|
|
1422
1431
|
var FALLBACK_HEIGHT = 480;
|
|
1423
1432
|
var EMPTY_BODY_HEIGHT = 240;
|
|
@@ -1689,6 +1698,7 @@ function TableInner({
|
|
|
1689
1698
|
const contextMenuEnabled = contextMenuConfig !== false;
|
|
1690
1699
|
const customContextMenuConfig = typeof contextMenuConfig === "object" ? contextMenuConfig : void 0;
|
|
1691
1700
|
const [resizedColumnWidths, setResizedColumnWidths] = useState4({});
|
|
1701
|
+
const [manuallyResizedColumnKeys, setManuallyResizedColumnKeys] = useState4(() => /* @__PURE__ */ new Set());
|
|
1692
1702
|
const leafSourceColumns = useMemo(() => flattenDataColumns(sourceColumns), [sourceColumns]);
|
|
1693
1703
|
const sourceColumnWidthsRef = useRef2(new Map(leafSourceColumns.map((column) => [column.key, column.width])));
|
|
1694
1704
|
const showRowCheckbox = Boolean(rowSelection) && (typeof rowSelection !== "object" || rowSelection.showCheckbox !== false);
|
|
@@ -1810,6 +1820,10 @@ function TableInner({
|
|
|
1810
1820
|
const previousSourceWidths = sourceColumnWidthsRef.current;
|
|
1811
1821
|
const nextSourceWidths = new Map(leafSourceColumns.map((column) => [column.key, column.width]));
|
|
1812
1822
|
sourceColumnWidthsRef.current = nextSourceWidths;
|
|
1823
|
+
setManuallyResizedColumnKeys((current) => {
|
|
1824
|
+
const next = new Set([...current].filter((key) => nextSourceWidths.has(key) && previousSourceWidths.get(key) === nextSourceWidths.get(key)));
|
|
1825
|
+
return next.size === current.size ? current : next;
|
|
1826
|
+
});
|
|
1813
1827
|
setResizedColumnWidths((current) => {
|
|
1814
1828
|
const sourceColumnByKey = new Map(leafSourceColumns.map((column) => [column.key, column]));
|
|
1815
1829
|
let changed = false;
|
|
@@ -2071,11 +2085,14 @@ function TableInner({
|
|
|
2071
2085
|
if (selection?.rowKey === editing.rowKey && selection.columnKey === editing.columnKey) return;
|
|
2072
2086
|
setEditing(null);
|
|
2073
2087
|
}, [editing, selection]);
|
|
2074
|
-
const
|
|
2088
|
+
const stretchExcludedIndices = useMemo(() => new Set(
|
|
2089
|
+
columns.flatMap((column, index) => manuallyResizedColumnKeys.has(column.key) ? [index] : [])
|
|
2090
|
+
), [columns, manuallyResizedColumnKeys]);
|
|
2075
2091
|
const metrics = useMemo(() => buildColumnMetrics(columns, {
|
|
2076
2092
|
columnDraggable,
|
|
2077
|
-
viewportWidth:
|
|
2078
|
-
|
|
2093
|
+
viewportWidth: viewport.width,
|
|
2094
|
+
stretchExcludedIndices
|
|
2095
|
+
}), [columnDraggable, columns, stretchExcludedIndices, viewport.width]);
|
|
2079
2096
|
const contentWidth = metrics.length > 0 ? metrics[metrics.length - 1].right : 0;
|
|
2080
2097
|
const contentHeight = rows.length * rowHeight;
|
|
2081
2098
|
const fixedWidth = useMemo(() => columns.reduce((width2, column, index) => column.fixed === "left" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
|
|
@@ -2860,6 +2877,7 @@ function TableInner({
|
|
|
2860
2877
|
return headerDepth - 1;
|
|
2861
2878
|
}, [headerDepth, headerRowHeights, headerRowOffsets]);
|
|
2862
2879
|
const resizeColumn = useCallback2((columnKey, width2) => {
|
|
2880
|
+
setManuallyResizedColumnKeys((current) => current.has(columnKey) ? current : new Set(current).add(columnKey));
|
|
2863
2881
|
setResizedColumnWidths((current) => current[columnKey] === width2 ? current : { ...current, [columnKey]: width2 });
|
|
2864
2882
|
onColumnResize?.(columnKey, width2);
|
|
2865
2883
|
}, [onColumnResize]);
|
|
@@ -3005,15 +3023,7 @@ function TableInner({
|
|
|
3005
3023
|
useEffect2(() => {
|
|
3006
3024
|
const canvas = canvasRef.current;
|
|
3007
3025
|
if (!canvas || !columnDraggable && !rowDraggable) return;
|
|
3008
|
-
const getColumnDropIndex = (sourceIndex, targetIndex, edge) =>
|
|
3009
|
-
if (edge === "right") return targetIndex;
|
|
3010
|
-
const destinationIndex = targetIndex - (sourceIndex < targetIndex ? 1 : 0);
|
|
3011
|
-
return Math.max(0, Math.min(columns.length - 1, destinationIndex));
|
|
3012
|
-
};
|
|
3013
|
-
const getColumnDropPlacement = (sourceIndex, targetIndex, edge) => {
|
|
3014
|
-
if (edge !== "right") return "before";
|
|
3015
|
-
return targetIndex < sourceIndex ? "before" : "after";
|
|
3016
|
-
};
|
|
3026
|
+
const getColumnDropIndex = (sourceIndex, targetIndex, edge) => resolveColumnDropIndex(sourceIndex, targetIndex, edge, columns.length);
|
|
3017
3027
|
const getHeaderColumn = (clientX, clientY) => {
|
|
3018
3028
|
const rect = canvas.getBoundingClientRect();
|
|
3019
3029
|
const headerY = fixedHeader ? 0 : -scrollRef.current.top;
|
|
@@ -3023,8 +3033,9 @@ function TableInner({
|
|
|
3023
3033
|
};
|
|
3024
3034
|
const getHeaderDragCell = (clientX, clientY) => {
|
|
3025
3035
|
const cell = locateHeaderCell(clientX, clientY);
|
|
3026
|
-
if (!cell) return null;
|
|
3027
|
-
|
|
3036
|
+
if (!cell || locateHeaderResizeCell(clientX, clientY)) return null;
|
|
3037
|
+
if (cell.leaf && locateHeaderAction(clientX, cell.startIndex)) return null;
|
|
3038
|
+
return cell;
|
|
3028
3039
|
};
|
|
3029
3040
|
const cleanupDrag = draggable({
|
|
3030
3041
|
element: canvas,
|
|
@@ -3285,7 +3296,7 @@ function TableInner({
|
|
|
3285
3296
|
sourceKey: String(source.data.sourceKey),
|
|
3286
3297
|
targetKey: validDrop.targetKey,
|
|
3287
3298
|
parentKey: validDrop.parentKey,
|
|
3288
|
-
placement:
|
|
3299
|
+
placement: resolveColumnDropPlacement(validDrop.columnEdge)
|
|
3289
3300
|
}
|
|
3290
3301
|
);
|
|
3291
3302
|
}
|
|
@@ -3340,7 +3351,7 @@ function TableInner({
|
|
|
3340
3351
|
cleanupDrag();
|
|
3341
3352
|
cleanupDrop();
|
|
3342
3353
|
};
|
|
3343
|
-
}, [applyColumnOrder, applyRowOrder, bodyTop, columnDraggable, columns, filterValues, fixedHeader, getCellLabel, getDisplayedColumnLeft, getHeaderCellWidth, getRowKey, headerActionSize, headerActionSlotWidth, headerCells, headerHeight, hideDragTooltips, locateColumn,
|
|
3354
|
+
}, [applyColumnOrder, applyRowOrder, bodyTop, columnDraggable, columns, filterValues, fixedHeader, getCellLabel, getDisplayedColumnLeft, getHeaderCellWidth, getRowKey, headerActionSize, headerActionSlotWidth, headerCells, headerHeight, hideDragTooltips, locateColumn, locateHeaderAction, locateHeaderCell, locateHeaderResizeCell, locateRow, measureHeaderTitleWidth, metrics, rowDraggable, rowHeight, rows, selectedRowKeySet, selection, setDragGuide, setRowDragGuide, sortState, utilityColumnCount]);
|
|
3344
3355
|
const locateCell = useCallback2((clientX, clientY) => {
|
|
3345
3356
|
const canvas = canvasRef.current;
|
|
3346
3357
|
if (!canvas) return null;
|
|
@@ -3796,7 +3807,7 @@ function TableInner({
|
|
|
3796
3807
|
const isAxisSelected = selectedColumnKeySet.has(column.key);
|
|
3797
3808
|
const selectedClassName = isAxisSelected ? " is-axis-selected" : "";
|
|
3798
3809
|
const hoveredColumnClassName = hoveredHeaderColumnIndex === columnIndex ? " is-header-hovered" : "";
|
|
3799
|
-
const top = headerLeafTop + (headerLeafHeight - headerActionSize) / 2;
|
|
3810
|
+
const top = column.renderHeader ? headerLeafTop + 8 + Math.max(0, (16 - headerActionSize) / 2) : headerLeafTop + (headerLeafHeight - headerActionSize) / 2;
|
|
3800
3811
|
const visibleActions = getVisibleHeaderActions(column, metrics[columnIndex].width, columnDraggable, measureHeaderTitleWidth(columnIndex), headerActionSlotWidth);
|
|
3801
3812
|
let right = left + metrics[columnIndex].width - (visibleActions.drag ? headerActionSlotWidth : 2);
|
|
3802
3813
|
const icons = [];
|