Skip to content

Commit

Permalink
fix(table): restrict movement to only the vertical axis.
Browse files Browse the repository at this point in the history
close #7477
  • Loading branch information
chenshuai2144 committed Aug 4, 2023
1 parent 870cfbe commit 5a8f9fb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@ant-design/pro-utils": "2.12.8",
"@babel/runtime": "^7.18.0",
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/modifiers": "^6.0.1",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.1",
"classnames": "^2.3.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/table/src/utils/useDragSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useSensor,
useSensors,
} from '@dnd-kit/core';
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
import {
arrayMove,
SortableContext,
Expand Down Expand Up @@ -180,6 +181,7 @@ export function useDragSort<T>(props: UseDragSortOptions<T>) {
DndContext: (contextProps: any) => {
return (
<DndContext
modifiers={[restrictToVerticalAxis]}
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a8f9fb

Please sign in to comment.