1111// See the License for the specific language governing permissions and
1212// limitations under the License.
1313
14- import { Column , HeaderGroup , Row , flexRender } from '@tanstack/react-table' ;
14+ import { Column , ColumnMeta , HeaderGroup , Row , flexRender } from '@tanstack/react-table' ;
1515import { Box , TablePagination , TableRow as MuiTableRow } from '@mui/material' ;
1616import { TableVirtuoso , TableComponents , TableVirtuosoHandle , TableVirtuosoProps } from 'react-virtuoso' ;
1717import { useRef , useMemo , ReactElement } from 'react' ;
@@ -22,7 +22,7 @@ import { TableHead } from './TableHead';
2222import { TableHeaderCell } from './TableHeaderCell' ;
2323import { TableCell , TableCellProps } from './TableCell' ;
2424import { VirtualizedTableContainer } from './VirtualizedTableContainer' ;
25- import { TableCellConfigs , TableProps , TableRowEventOpts } from './model/table-model' ;
25+ import { TableCellConfigs , TableColumnConfig , TableProps , TableRowEventOpts } from './model/table-model' ;
2626import { useVirtualizedTableKeyboardNav } from './hooks/useVirtualizedTableKeyboardNav' ;
2727import { TableFoot } from './TableFoot' ;
2828
@@ -72,6 +72,7 @@ export function VirtualizedTable<TableData>({
7272 startIndex : 0 ,
7373 endIndex : 0 ,
7474 } ) ;
75+
7576 const setVisibleRange : TableVirtuosoProps < TableData , unknown > [ 'rangeChanged' ] = ( newVisibleRange ) => {
7677 visibleRange . current = newVisibleRange ;
7778 } ;
@@ -218,7 +219,6 @@ export function VirtualizedTable<TableData>({
218219 < >
219220 { row . getVisibleCells ( ) . map ( ( cell , i , cells ) => {
220221 const position : TableCellPosition = {
221- // Add 1 to the row index because the header is row 0
222222 row : index + 1 ,
223223 column : i ,
224224 } ;
@@ -229,6 +229,16 @@ export function VirtualizedTable<TableData>({
229229 const cellRenderFn = cell . column . columnDef . cell ;
230230 const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn ( cellContext ) : null ;
231231
232+ /*
233+ IMPORTANT:
234+ If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)
235+ Components have no access to any context (Which is intentional and correct)
236+ We may want to add parameters to a link from neighboring cells in the future as well.
237+ If this is the case, the value of the neighboring cells should be read from here and be replaced. (Bing discussed at the moment, not decided yet)
238+ */
239+ const { dataLink } = cell . column . columnDef . meta as ColumnMeta < TableData , unknown > &
240+ Pick < TableColumnConfig < TableData > , 'dataLink' > ;
241+
232242 const cellDescriptionDef = cell . column . columnDef . meta ?. cellDescription ;
233243 let description : string | undefined = undefined ;
234244 if ( typeof cellDescriptionDef === 'function' ) {
@@ -258,6 +268,7 @@ export function VirtualizedTable<TableData>({
258268 description = { description }
259269 color = { cellConfig ?. textColor ?? undefined }
260270 backgroundColor = { cellConfig ?. backgroundColor ?? undefined }
271+ dataLink = { dataLink }
261272 >
262273 { cellConfig ?. text || cellContent }
263274 </ TableCell >
0 commit comments