@@ -173,6 +173,7 @@ export function Table({
173173 const containerRef = useRef < HTMLDivElement > ( null )
174174 const scrollRef = useRef < HTMLDivElement > ( null )
175175 const isDraggingRef = useRef ( false )
176+ const suppressFocusScrollRef = useRef ( false )
176177
177178 const {
178179 tableData,
@@ -796,6 +797,7 @@ export function Table({
796797 if ( rws . length === 0 || currentCols . length === 0 ) return
797798 setEditingCell ( null )
798799 setCheckedRows ( ( prev ) => ( prev . size === 0 ? prev : EMPTY_CHECKED_ROWS ) )
800+ suppressFocusScrollRef . current = true
799801 setSelectionAnchor ( { rowIndex : 0 , colIndex : 0 } )
800802 setSelectionFocus ( {
801803 rowIndex : maxPositionRef . current ,
@@ -1155,6 +1157,10 @@ export function Table({
11551157
11561158 useEffect ( ( ) => {
11571159 if ( isColumnSelection ) return
1160+ if ( suppressFocusScrollRef . current ) {
1161+ suppressFocusScrollRef . current = false
1162+ return
1163+ }
11581164 const target = selectionFocus ?? selectionAnchor
11591165 if ( ! target ) return
11601166 const { rowIndex, colIndex } = target
@@ -2685,7 +2691,10 @@ export function Table({
26852691 < >
26862692 { rows . map ( ( row , index ) => {
26872693 const prevPosition = index > 0 ? rows [ index - 1 ] . position : - 1
2688- const gapCount = queryOptions . filter ? 0 : row . position - prevPosition - 1
2694+ const gapCount =
2695+ queryOptions . filter || queryOptions . sort
2696+ ? 0
2697+ : row . position - prevPosition - 1
26892698 return (
26902699 < React . Fragment key = { row . id } >
26912700 { gapCount > 0 && (
@@ -2938,7 +2947,7 @@ export function Table({
29382947}
29392948
29402949const GAP_ROW_LIMIT = 200
2941- const GAP_CHECKBOX_CLASS = cn ( CELL_CHECKBOX , 'group/checkbox cursor-pointer text-center ' )
2950+ const GAP_CHECKBOX_CLASS = cn ( CELL_CHECKBOX , 'cursor-pointer' )
29422951
29432952interface PositionGapRowsProps {
29442953 count : number
@@ -2975,28 +2984,32 @@ const PositionGapRows = React.memo(
29752984 const isGapChecked = checkedRows . has ( position )
29762985 return (
29772986 < tr key = { `gap-${ position } ` } >
2978- < td
2979- className = { GAP_CHECKBOX_CLASS }
2980- onMouseDown = { ( e ) => {
2981- if ( e . button !== 0 ) return
2982- onRowToggle ( position , e . shiftKey )
2983- } }
2984- >
2985- < span
2986- className = { cn (
2987- 'text-[var(--text-tertiary)] text-xs tabular-nums' ,
2988- isGapChecked ? 'hidden' : 'block group-hover/checkbox:hidden'
2989- ) }
2990- >
2991- { position + 1 }
2992- </ span >
2993- < div
2994- className = { cn (
2995- 'items-center justify-center' ,
2996- isGapChecked ? 'flex' : 'hidden group-hover/checkbox:flex'
2997- ) }
2998- >
2999- < Checkbox size = 'sm' checked = { isGapChecked } className = 'pointer-events-none' />
2987+ < td className = { GAP_CHECKBOX_CLASS } >
2988+ < div className = 'flex items-center justify-center gap-1' >
2989+ < div
2990+ className = 'group/checkbox flex h-[20px] w-[24px] shrink-0 items-center justify-center'
2991+ onMouseDown = { ( e ) => {
2992+ if ( e . button !== 0 ) return
2993+ onRowToggle ( position , e . shiftKey )
2994+ } }
2995+ >
2996+ < span
2997+ className = { cn (
2998+ 'text-[var(--text-tertiary)] text-xs tabular-nums' ,
2999+ isGapChecked ? 'hidden' : 'block group-hover/checkbox:hidden'
3000+ ) }
3001+ >
3002+ { position + 1 }
3003+ </ span >
3004+ < div
3005+ className = { cn (
3006+ 'items-center justify-center' ,
3007+ isGapChecked ? 'flex' : 'hidden group-hover/checkbox:flex'
3008+ ) }
3009+ >
3010+ < Checkbox size = 'sm' checked = { isGapChecked } className = 'pointer-events-none' />
3011+ </ div >
3012+ </ div >
30003013 </ div >
30013014 </ td >
30023015 { columns . map ( ( col , colIndex ) => {
@@ -3238,7 +3251,7 @@ const DataRow = React.memo(function DataRow({
32383251 return (
32393252 < tr onContextMenu = { ( e ) => onContextMenu ( e , row ) } >
32403253 < td className = { cn ( CELL_CHECKBOX , 'cursor-pointer' ) } >
3241- < div className = 'flex items-center justify-between gap-1' >
3254+ < div className = 'flex items-center justify-center gap-1' >
32423255 < div
32433256 className = 'group/checkbox flex h-[20px] w-[24px] shrink-0 items-center justify-center'
32443257 onMouseDown = { ( e ) => {
@@ -3268,7 +3281,7 @@ const DataRow = React.memo(function DataRow({
32683281 type = 'button'
32693282 aria-label = { runningCount > 0 ? `Stop ${ runningCount } running` : 'Run row' }
32703283 title = { runningCount > 0 ? `Stop ${ runningCount } running` : 'Run row' }
3271- className = 'flex h-[20px] w-[20px] shrink-0 items-center justify-center rounded text-[var(--text-primary)] transition-colors hover-hover:bg-[var(--surface-2)]'
3284+ className = 'ml-auto flex h-[20px] w-[20px] shrink-0 items-center justify-center rounded text-[var(--text-primary)] transition-colors hover-hover:bg-[var(--surface-2)]'
32723285 onClick = { ( ) => {
32733286 if ( runningCount > 0 ) {
32743287 onStopRow ( row . id )
0 commit comments