https://github.com/cczx/react-sort-table
可拖拽排序的react表格组件
https://github.com/cczx/react-sort-table
component drag-and-drop react sort storybook table tsdx
Last synced: about 2 months ago
JSON representation
可拖拽排序的react表格组件
- Host: GitHub
- URL: https://github.com/cczx/react-sort-table
- Owner: CCZX
- License: mit
- Created: 2020-12-26T09:15:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-17T15:59:33.000Z (over 5 years ago)
- Last Synced: 2025-09-03T18:52:39.725Z (10 months ago)
- Topics: component, drag-and-drop, react, sort, storybook, table, tsdx
- Language: TypeScript
- Homepage:
- Size: 638 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A react table component that can be dragged and sorted
## install
```bash
// npm
npm install react-drag-sort-table
// yarn
yarn add react-drag-sort-table
```
## use
```js
import DragSortTable from 'react-drag-sort-table'
import 'react-drag-sort-table/dist/dist.min.css'
```
## API
### Table
| prop | description | 类型 | required | default value |
| ---- | ---- | ---- | ---- | ---- |
| dataSource | 数据数组 | object[] | true | [] |
| columns | | | true | |
| canDragSort | 是否使用拖拽排序 | boolean | false | rue |
| canAdjustWidth | 是否可以调整宽度 | | false | |
| customDragSortIcon | | | false | |
| align | | | false | |
| onSortDataSource | dataSource顺序改变处理函数,参数分别是当前的值,当前行的值,当前行索引 | (text, rowData, index) => void | true | |