@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
15 lines (14 loc) • 618 B
JavaScript
export const makeRowDetailRenderedHeight = (grid) => {
return (rowOrId) => {
const index = grid.state.rowDataSource
.get()
.rowToIndex(typeof rowOrId === "string" ? rowOrId : rowOrId.id);
if (index == null || !grid.api.rowDetailIsExpanded(rowOrId))
return 0;
const rowDetailHeight = grid.state.rowDetailHeight.get();
if (typeof rowDetailHeight === "number")
return rowDetailHeight;
const cache = grid.internal.rowDetailAutoHeightCache.get();
return cache[index] ?? grid.state.rowDetailAutoHeightGuess.get();
};
};