From 5a8f9fb9127cc58972b279fc3577b240b5b8b445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=9F=E8=B4=A4?= Date: Fri, 4 Aug 2023 14:21:54 +0800 Subject: [PATCH] fix(table): restrict movement to only the vertical axis. close https://github.com/ant-design/pro-components/issues/7477 --- packages/table/package.json | 1 + packages/table/src/utils/useDragSort.tsx | 2 ++ pnpm-lock.yaml | 15 +++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/packages/table/package.json b/packages/table/package.json index 2ff1e29c36d1..3ad6955c9172 100644 --- a/packages/table/package.json +++ b/packages/table/package.json @@ -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", diff --git a/packages/table/src/utils/useDragSort.tsx b/packages/table/src/utils/useDragSort.tsx index 19d9544088cd..9efeacc7ffa4 100644 --- a/packages/table/src/utils/useDragSort.tsx +++ b/packages/table/src/utils/useDragSort.tsx @@ -8,6 +8,7 @@ import { useSensor, useSensors, } from '@dnd-kit/core'; +import { restrictToVerticalAxis } from '@dnd-kit/modifiers'; import { arrayMove, SortableContext, @@ -180,6 +181,7 @@ export function useDragSort(props: UseDragSortOptions) { DndContext: (contextProps: any) => { return ( =16.8.0' + dependencies: + '@dnd-kit/core': 6.0.8(react-dom@18.2.0)(react@18.2.0) + '@dnd-kit/utilities': 3.2.1(react@18.2.0) + react: 18.2.0 + tslib: 2.6.1 + dev: false + /@dnd-kit/sortable@7.0.2(@dnd-kit/core@6.0.8)(react@18.2.0): resolution: {integrity: sha512-wDkBHHf9iCi1veM834Gbk1429bd4lHX4RpAwT0y2cHLf246GAvU2sVw/oxWNpPKQNQRQaeGXhAVgrOl1IT+iyA==} peerDependencies: