diff --git a/lib/dtable/src/plugins/sortable/index.tsx b/lib/dtable/src/plugins/sortable/index.tsx index 44eceadb7b..678a12747f 100644 --- a/lib/dtable/src/plugins/sortable/index.tsx +++ b/lib/dtable/src/plugins/sortable/index.tsx @@ -38,7 +38,8 @@ export type DTableSortableTypes = { data: { disableCheckable?: boolean, disableSortable?: boolean, - sortableInfo?: {from: RowInfo, offset: number, state?: SortingState}; + sortableInfo?: {from: RowInfo, offset: number, state?: SortingState, startMouseY: number, lastMouseY: number}; + ignoreNextClick?: number; }, methods: { getSortingState(this: DTableSortable, event: MouseEvent): SortingState | undefined; @@ -61,7 +62,16 @@ const sortablePlugin: DTablePlugin !!options.sortable, plugins: [mousemove, autoscroll], events: { + click(event) { + if (this.data.ignoreNextClick) { + event.preventDefault(); + this.data.ignoreNextClick = undefined; + } + }, mousedown(event) { + if (this.data.ignoreNextClick) { + clearTimeout(this.data.ignoreNextClick); + } if (this.data.disableSortable) { return; } @@ -78,10 +88,12 @@ const sortablePlugin: DTablePlugin 4) { + this.data.ignoreNextClick = window.setTimeout(() => { + this.data.ignoreNextClick = undefined; + }); + } + this.disableAnimation(); this.update({ dirtyType: 'layout', @@ -143,6 +161,7 @@ const sortablePlugin: DTablePlugin