File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,13 +71,29 @@ function Query() {
7171 < Card className = "p-2 overflow-auto" >
7272 < DataGrid
7373 defaultColumnOptions = { { resizable : true } }
74- columns = { data . columns . map ( ( col ) => ( { key : col , name : col } ) ) }
74+ columns = { data . columns . map ( ( col ) => ( {
75+ key : col ,
76+ name : col ,
77+ renderCell : ( { row } : { row : Record < string , unknown > } ) => (
78+ < div style = { { whiteSpace : "pre-wrap" } } >
79+ { String ( row [ col ] ?? "" ) }
80+ </ div >
81+ ) ,
82+ } ) ) }
7583 rows = { data . rows . map ( ( row ) =>
7684 row . reduce ( ( acc , curr , i ) => {
7785 acc [ data . columns [ i ] ] = curr ;
7886 return acc ;
7987 } , { } ) ,
8088 ) }
89+ rowHeight = { ( row ) => {
90+ const maxLines = data . columns . reduce ( ( max , col ) => {
91+ const val = String ( row [ col ] ?? "" ) ;
92+ const lines = val . split ( / \r ? \n / ) . length ;
93+ return Math . max ( max , lines ) ;
94+ } , 1 ) ;
95+ return Math . max ( 35 , maxLines * 20 + 15 ) ;
96+ } }
8197 className = { cn ( currentTheme === "light" ? "rdg-light" : "rdg-dark" ) }
8298 />
8399 </ Card >
You can’t perform that action at this time.
0 commit comments