@@ -156,8 +156,10 @@ function buildGridTemplateColumns(columns: ResourceColumn[], hasCheckbox: boolea
156156 const weights = columns . map (
157157 ( col , colIdx ) => ( colIdx === 0 ? 2.5 : 1.0 ) * ( col . widthMultiplier ?? 1 )
158158 )
159- const total = weights . reduce ( ( s , w ) => s + w , 0 )
160- const tracks = columns . map ( ( _ , colIdx ) => `minmax(0, ${ ( weights [ colIdx ] / total ) . toFixed ( 6 ) } fr)` )
159+ const tracks = columns . map ( ( _ , colIdx ) => {
160+ const track = `minmax(0, ${ weights [ colIdx ] } fr)`
161+ return colIdx === 0 ? `var(--resource-table-name-width, ${ track } )` : track
162+ } )
161163 return hasCheckbox ? `${ CHECKBOX_COLUMN_WIDTH } ${ tracks . join ( ' ' ) } ` : tracks . join ( ' ' )
162164}
163165
@@ -381,7 +383,7 @@ const ResourceTable = memo(function ResourceTable({
381383 < div
382384 ref = { scrollRef }
383385 className = { cn (
384- 'min-h-0 flex-1 overflow-auto overscroll-none' ,
386+ '@container/resource-table min-h-0 flex-1 overflow-auto overscroll-none' ,
385387 showEmptyState && 'flex flex-col'
386388 ) }
387389 onDragOver = { bodyDrop ?. onDragOver }
@@ -390,10 +392,11 @@ const ResourceTable = memo(function ResourceTable({
390392 >
391393 < div
392394 role = 'table'
393- className = 'grid w-full min-w-[var(--resource-table-min-width)] text-small md:min-w-0'
395+ className = 'grid w-full min-w-[var(--resource-table-min-width)] text-small md:min-w-0 max-md:[--resource-table-name-width:calc(100cqw_-_var(--resource-table-selection-width))] '
394396 style = {
395397 {
396- '--resource-table-min-width' : `${ Math . max ( 360 , columns . length * 136 + 120 + ( hasCheckbox ? 52 : 0 ) ) } px` ,
398+ '--resource-table-min-width' : `calc(100cqw + ${ Math . max ( 0 , columns . length - 1 ) * 136 } px)` ,
399+ '--resource-table-selection-width' : hasCheckbox ? CHECKBOX_COLUMN_WIDTH : '0px' ,
397400 } as CSSProperties
398401 }
399402 >
@@ -405,22 +408,23 @@ const ResourceTable = memo(function ResourceTable({
405408 { hasCheckbox && (
406409 < div
407410 role = 'columnheader'
408- className = 'flex h-10 items-center py-1.5 pr-0 pl-5 text-left'
411+ className = 'flex h-10 items-center py-1.5 pr-0 pl-5 text-left max-md:h-11 '
409412 >
410413 < Checkbox
411414 size = 'sm'
412415 checked = { selectable . isAllSelected }
413416 onCheckedChange = { handleSelectAll }
414417 disabled = { selectable . disabled }
415418 aria-label = 'Select all'
419+ className = 'max-md:before:inset-[-15px]'
416420 />
417421 </ div >
418422 ) }
419423 { columns . map ( ( col ) => (
420424 < div
421425 key = { col . id }
422426 role = 'columnheader'
423- className = 'flex h-10 min-w-0 items-center px-3 py-1.5 text-left font-normal text-[var(--text-muted)] text-small md:px-6'
427+ className = 'flex h-10 min-w-0 items-center px-3 py-1.5 text-left font-normal text-[var(--text-muted)] text-small max-md:h-11 md:px-6'
424428 >
425429 < span className = 'min-w-0 truncate' > { col . header } </ span >
426430 </ div >
@@ -775,6 +779,7 @@ const DataRow = memo(function DataRow({
775779 onCheckedChange = { handleSelectRow }
776780 disabled = { selectable . disabled }
777781 aria-label = 'Select row'
782+ className = 'max-md:before:inset-[-15px]'
778783 onClick = { handleSelectRowClick }
779784 />
780785 </ div >
@@ -787,17 +792,6 @@ const DataRow = memo(function DataRow({
787792 role = 'cell'
788793 className = 'flex min-h-11 min-w-0 items-center gap-1 px-3 pointer-coarse:py-0 py-0 md:min-h-0 md:px-6 md:py-2.5'
789794 >
790- { index === 0 && onRowContextMenu && (
791- < Chip
792- leftIcon = { MoreHorizontal }
793- aria-label = { cell ?. label ? `Actions for ${ cell . label } ` : 'Row actions' }
794- className = 'pointer-coarse:flex hidden size-11 shrink-0 justify-center max-md:flex'
795- onClick = { ( event ) => {
796- event . stopPropagation ( )
797- onRowContextMenu ( event , row . id )
798- } }
799- />
800- ) }
801795 < CellContent
802796 icon = { cell ?. icon }
803797 label = { cell ?. label || EMPTY_CELL_PLACEHOLDER }
@@ -806,6 +800,20 @@ const DataRow = memo(function DataRow({
806800 pinned = { cell ?. pinned }
807801 highlight = { cell ?. highlight }
808802 />
803+ { index === 0 && onRowContextMenu && (
804+ < div className = 'ml-auto pointer-coarse:flex hidden shrink-0 max-md:flex' >
805+ < Chip
806+ leftIcon = { MoreHorizontal }
807+ mobileIconOnly
808+ aria-label = { cell ?. label ? `Actions for ${ cell . label } ` : 'Row actions' }
809+ className = 'size-11 justify-center'
810+ onClick = { ( event ) => {
811+ event . stopPropagation ( )
812+ onRowContextMenu ( event , row . id )
813+ } }
814+ />
815+ </ div >
816+ ) }
809817 </ div >
810818 )
811819 } ) }
0 commit comments