|
|
@ -432,12 +432,7 @@ export function TableNG(props: TableNGProps) { |
|
|
|
if (!expandedRows.includes(rowIdx)) { |
|
|
|
if (!expandedRows.includes(rowIdx)) { |
|
|
|
setExpandedRows([...expandedRows, rowIdx]); |
|
|
|
setExpandedRows([...expandedRows, rowIdx]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const currentExpandedRows = expandedRows; |
|
|
|
setExpandedRows(expandedRows.filter((id) => id !== rowIdx)); |
|
|
|
const indexToRemove = currentExpandedRows.indexOf(rowIdx); |
|
|
|
|
|
|
|
if (indexToRemove > -1) { |
|
|
|
|
|
|
|
currentExpandedRows.splice(indexToRemove, 1); |
|
|
|
|
|
|
|
setExpandedRows(currentExpandedRows); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
setResizeTrigger((prev) => prev + 1); |
|
|
|
setResizeTrigger((prev) => prev + 1); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -535,7 +530,10 @@ export function TableNG(props: TableNGProps) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} else if (Number(row.__depth) === 1 && expandedRows.includes(Number(row.__index))) { |
|
|
|
} else if (Number(row.__depth) === 1 && expandedRows.includes(Number(row.__index))) { |
|
|
|
const headerCount = row?.data?.meta?.custom?.noHeader ? 0 : 1; |
|
|
|
const headerCount = row?.data?.meta?.custom?.noHeader ? 0 : 1; |
|
|
|
return defaultRowHeight * (row.data?.length ?? 0 + headerCount); // TODO this probably isn't very robust
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure we have a minimum height for the nested table even if data is empty
|
|
|
|
|
|
|
|
const rowCount = row.data?.length ?? 0; |
|
|
|
|
|
|
|
return Math.max(defaultRowHeight, defaultRowHeight * (rowCount + headerCount)); |
|
|
|
} |
|
|
|
} |
|
|
|
return getRowHeight(row, cellHeightCalc, avgCharWidth, defaultRowHeight, fieldsData); |
|
|
|
return getRowHeight(row, cellHeightCalc, avgCharWidth, defaultRowHeight, fieldsData); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -746,7 +744,7 @@ export function mapFrameToDataGrid({ |
|
|
|
calcsRef, |
|
|
|
calcsRef, |
|
|
|
options: { ...options }, |
|
|
|
options: { ...options }, |
|
|
|
handlers: { onCellExpand, onColumnResize }, |
|
|
|
handlers: { onCellExpand, onColumnResize }, |
|
|
|
availableWidth: availableWidth - COLUMN.EXPANDER_WIDTH, |
|
|
|
availableWidth, |
|
|
|
}); |
|
|
|
}); |
|
|
|
expandedRecords = frameToRecords(row.data); |
|
|
|
expandedRecords = frameToRecords(row.data); |
|
|
|
} |
|
|
|
} |
|
|
@ -757,7 +755,8 @@ export function mapFrameToDataGrid({ |
|
|
|
rows={expandedRecords} |
|
|
|
rows={expandedRecords} |
|
|
|
columns={expandedColumns} |
|
|
|
columns={expandedColumns} |
|
|
|
rowHeight={defaultRowHeight} |
|
|
|
rowHeight={defaultRowHeight} |
|
|
|
style={{ height: '100%', overflow: 'visible', marginLeft: COLUMN.EXPANDER_WIDTH }} |
|
|
|
className={styles.dataGrid} |
|
|
|
|
|
|
|
style={{ height: '100%', overflow: 'visible', marginLeft: COLUMN.EXPANDER_WIDTH - 1 }} |
|
|
|
headerRowHeight={row.data?.meta?.custom?.noHeader ? 0 : undefined} |
|
|
|
headerRowHeight={row.data?.meta?.custom?.noHeader ? 0 : undefined} |
|
|
|
/> |
|
|
|
/> |
|
|
|
); |
|
|
|
); |
|
|
|