From 590b0845653778cff73487e872b21e8866b92b49 Mon Sep 17 00:00:00 2001 From: linxianxi <47104575+linxianxi@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:54:13 +0800 Subject: [PATCH] demo: add table drag sorting handler demo (#40346) * demo: add table drag sorting handler demo * update snapshot --- .../__snapshots__/demo-extend.test.ts.snap | 308 +++++++++++++++++- .../__tests__/__snapshots__/demo.test.ts.snap | 308 +++++++++++++++++- components/table/demo/drag-sorting-handler.md | 7 + .../table/demo/drag-sorting-handler.tsx | 139 ++++++++ components/table/demo/drag-sorting.md | 14 +- components/table/demo/drag-sorting.tsx | 153 ++++----- components/table/index.en-US.md | 1 + components/table/index.zh-CN.md | 1 + package.json | 3 + 9 files changed, 825 insertions(+), 109 deletions(-) create mode 100644 components/table/demo/drag-sorting-handler.md create mode 100644 components/table/demo/drag-sorting-handler.tsx diff --git a/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap index 0b568b4e11..0b09cc8033 100644 --- a/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/table/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -2000,9 +2000,14 @@ exports[`renders ./components/table/demo/drag-sorting.tsx extend context correct class="ant-table-tbody" >
+ | + Name + | ++ Age + | ++ Address + | +
---|---|---|---|
+ | + ++ John Brown + | ++ 32 + | ++ Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text + | +
+ | + ++ Jim Green + | ++ 42 + | ++ London No. 1 Lake Park + | +
+ | + ++ Joe Black + | ++ 32 + | ++ Sidney No. 1 Lake Park |
- New York No. 1 Lake Park + Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text | |||
- Sydney No. 1 Lake Park + Sidney No. 1 Lake Park + | +
+ | + Name + | ++ Age + | ++ Address + | +
---|---|---|---|
+ | + ++ John Brown + | ++ 32 + | ++ Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text Long text + | +
+ | + ++ Jim Green + | ++ 42 + | ++ London No. 1 Lake Park + | +
+ | + ++ Joe Black + | ++ 32 + | ++ Sidney No. 1 Lake Park |
Editable Rows
Nested tables
Drag sorting
+Drag sorting with handler
Resizable column
ellipsis column
ellipsis column custom tooltip
diff --git a/components/table/index.zh-CN.md b/components/table/index.zh-CN.md
index b50d7b9f8f..7b08e46e2a 100644
--- a/components/table/index.zh-CN.md
+++ b/components/table/index.zh-CN.md
@@ -92,6 +92,7 @@ const columns = [
可编辑行
嵌套子表格
拖拽排序
+拖拽手柄列
可伸缩列
单元格自动省略
自定义单元格省略提示
diff --git a/package.json b/package.json
index d7e580f5fd..6ceb8558e3 100644
--- a/package.json
+++ b/package.json
@@ -158,6 +158,9 @@
"devDependencies": {
"@ant-design/tools": "^17.0.0",
"@babel/eslint-plugin": "^7.19.1",
+ "@dnd-kit/core": "^6.0.7",
+ "@dnd-kit/sortable": "^7.0.2",
+ "@dnd-kit/utilities": "^3.2.1",
"@emotion/babel-preset-css-prop": "^11.10.0",
"@emotion/css": "^11.10.5",
"@emotion/react": "^11.10.4",