@@ -16,6 +16,7 @@ import {
1616 GroupableDataGridProps ,
1717 FlattenedNode ,
1818} from "./GroupableDataGrid.types" ;
19+
1920import { HierarchyDataManager } from "./utils/HierarchyDataManager" ;
2021import { useGroupExpansion } from "./hooks/useGroupExpansion" ;
2122import { useTreeNavigation } from "./hooks/useTreeNavigation" ;
@@ -133,13 +134,34 @@ function renderDataRow<T>(
133134 ? String ( value )
134135 : "—" ;
135136
137+ // Wrap content in a div when maxWidth is specified for proper truncation
138+ const wrappedContent = column . maxWidth ? (
139+ < div
140+ style = { {
141+ maxWidth : column . maxWidth ,
142+ overflow : 'hidden' ,
143+ textOverflow : 'ellipsis' ,
144+ whiteSpace : 'nowrap' ,
145+ } }
146+ title = { typeof cellContent === 'string' ? cellContent : undefined }
147+ >
148+ { cellContent }
149+ </ div >
150+ ) : cellContent ;
151+
136152 return (
137153 < td
138154 key = { column . key }
139155 className = "groupable-datagrid__data-cell"
140156 role = "gridcell"
157+ style = { {
158+ width : column . width ,
159+ minWidth : column . minWidth ,
160+ maxWidth : column . maxWidth ,
161+ textAlign : column . align ,
162+ } }
141163 >
142- { cellContent }
164+ { wrappedContent }
143165 </ td >
144166 ) ;
145167 } ) }
@@ -796,26 +818,32 @@ export const GroupableDataGrid = <T extends any = any>({
796818 ( s ) => s . key === column . key
797819 ) ;
798820
799- return (
800- < th
801- key = { column . key }
802- role = "columnheader"
803- aria-sort = {
804- columnSort
805- ? columnSort . direction === "asc"
806- ? "ascending"
807- : "descending"
808- : undefined
809- }
810- className = { classNames ( "groupable-datagrid__header-cell" , {
811- "groupable-datagrid__header-cell--sortable" : isSortable ,
812- "groupable-datagrid__header-cell--sorted" : ! ! columnSort ,
813- } ) }
814- onClick = {
815- isSortable ? ( ) => handleSort ( column . key ) : undefined
816- }
817- style = { { cursor : isSortable ? "pointer" : undefined } }
818- >
821+ return (
822+ < th
823+ key = { column . key }
824+ role = "columnheader"
825+ aria-sort = {
826+ columnSort
827+ ? columnSort . direction === "asc"
828+ ? "ascending"
829+ : "descending"
830+ : undefined
831+ }
832+ className = { classNames ( "groupable-datagrid__header-cell" , {
833+ "groupable-datagrid__header-cell--sortable" : isSortable ,
834+ "groupable-datagrid__header-cell--sorted" : ! ! columnSort ,
835+ } ) }
836+ onClick = {
837+ isSortable ? ( ) => handleSort ( column . key ) : undefined
838+ }
839+ style = { {
840+ cursor : isSortable ? "pointer" : undefined ,
841+ width : column . width ,
842+ minWidth : column . minWidth ,
843+ maxWidth : column . maxWidth ,
844+ textAlign : column . align ,
845+ } }
846+ >
819847 < div className = "groupable-datagrid__header-content" >
820848 < span > { column . label } </ span >
821849 { isSortable && (
0 commit comments