/** * 基于 sortablejs 实现表格的行与列的拖拽功能 * @docs https://github.com/SortableJS/Sortable * * (1) toArray() 会返回所有当前容器内的所有 tr 节点的 dataIdAttr 列表 * - 与是否手动标记过 `data-id` 无关,firstFullRow、lastFullRow、expandedRow 等都会被包含在内 * - 如果节点没有 `data-id`,该库会分配一个随机值存在内部 * * (2) sort([id1, id2]) 会根据传入的数组,自动重新排序 DOM 节点 * - 用于处理受控,恢复拖拽前的顺序,避免 onEnd 后直接更新,而是等外部数据更新,再进行重绘 */ import type { PrimaryTableRef } from '../interface'; import type { PaginationProps, TableRowData, TdPrimaryTableProps } from '../type'; interface DragSortOptions { primaryTableRef: React.MutableRefObject; innerPagination: React.MutableRefObject; } export declare const EXPANDED_SUFFIX = "__expanded"; export declare const DATA_ID_ATTR = "data-id"; export declare const DATA_PARENT_ID_ATTR = "data-parent-id"; declare function useDragSort(props: TdPrimaryTableProps, options: DragSortOptions): { isRowDraggable: boolean; isRowHandlerDraggable: boolean; isColDraggable: boolean; updateLastRowList: () => void; setDragSortColumns: import("react").Dispatch[]>>; }; export default useDragSort;