fix: error in tree table dragging and sorting (#2476)

This commit is contained in:
katherinehhh 2023-08-17 18:05:12 +08:00 committed by GitHub
parent 9dc08277e1
commit 3fc3d34aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,10 +304,9 @@ export const Table: any = observer(
}
const fromIndex = e.active?.data.current?.sortable?.index;
const toIndex = e.over?.data.current?.sortable?.index;
const from = field.value[fromIndex];
const to = field.value[toIndex];
field.move(fromIndex, toIndex);
onRowDragEnd({ fromIndex, toIndex, from, to });
const from = field.value[fromIndex] || e.active;
const to = field.value[toIndex] || e.over;
onRowDragEnd({ from, to });
}}
>
<tbody {...props} />