1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 00:00:00 +00:00

fix(metadata-table): scroll bugs via move column (#6916)

This commit is contained in:
Jerry Ren
2024-10-21 14:42:39 +08:00
committed by GitHub
parent e04c3f367b
commit 4ce79038b9

View File

@@ -89,14 +89,17 @@ const Cell = ({
}, [column, updateDraggingKey]);
const onDragEnter = useCallback(() => {
if (!draggingColumnKey) return;
updateDragOverKey(column.key);
}, [column, updateDragOverKey]);
}, [column, updateDragOverKey, draggingColumnKey]);
const onDragLeave = useCallback(() => {
if (!draggingColumnKey) return;
updateDragOverKey(null);
}, [updateDragOverKey]);
}, [updateDragOverKey, draggingColumnKey]);
const onDragOver = useCallback((event) => {
if (!draggingColumnKey) return;
event.preventDefault();
event.dataTransfer.dropEffect = 'move';
updateDragOverKey(column.key);
@@ -115,7 +118,7 @@ const Cell = ({
} else {
window.sfMetadataBody.clearHorizontalScroll();
}
}, [column, frozenColumnsWidth, updateDragOverKey]);
}, [column, frozenColumnsWidth, updateDragOverKey, draggingColumnKey]);
const onDrop = useCallback((event) => {
event.stopPropagation();
@@ -131,6 +134,7 @@ const Cell = ({
const onDragEnd = useCallback(() => {
updateDraggingKey(null);
updateDragOverKey(null);
window.sfMetadataBody.clearHorizontalScroll();
}, [updateDraggingKey, updateDragOverKey]);
const { key, name, type } = column;