Skip to content

Commit

Permalink
[data-grid] Remove minFirstColumn from GetHeadersParams interface (
Browse files Browse the repository at this point in the history
…#14450)

Co-authored-by: Rom Grk <romgrk.cc@gmail.com>
  • Loading branch information
k-rajat19 and romgrk authored Sep 18, 2024
1 parent 4c73098 commit edc76e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,16 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => {
getColumnFilters({
position: GridPinnedColumnPosition.LEFT,
renderContext: leftRenderContext,
minFirstColumn: leftRenderContext.firstColumnIndex,
maxLastColumn: leftRenderContext.lastColumnIndex,
})}
{getColumnFilters({
renderContext,
minFirstColumn: pinnedColumns.left.length,
maxLastColumn: visibleColumns.length - pinnedColumns.right.length,
})}
{rightRenderContext &&
getColumnFilters({
position: GridPinnedColumnPosition.RIGHT,
renderContext: rightRenderContext,
minFirstColumn: rightRenderContext.firstColumnIndex,
maxLastColumn: rightRenderContext.lastColumnIndex,
})}
</GridColumnHeaderRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export interface UseGridColumnHeadersProps {
export interface GetHeadersParams {
position?: GridPinnedColumnPosition;
renderContext?: GridColumnsRenderContext;
minFirstColumn?: number;
maxLastColumn?: number;
}

Expand Down Expand Up @@ -158,11 +157,8 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => {

// Helper for computation common between getColumnHeaders and getColumnGroupHeaders
const getColumnsToRender = (params?: GetHeadersParams) => {
const {
renderContext: currentContext = renderContext,
// TODO: `minFirstColumn` is not used anymore, could be refactored out.
maxLastColumn = visibleColumns.length,
} = params || {};
const { renderContext: currentContext = renderContext, maxLastColumn = visibleColumns.length } =
params || {};

const firstColumnToRender = currentContext.firstColumnIndex;
const lastColumnToRender = !hasVirtualization ? maxLastColumn : currentContext.lastColumnIndex;
Expand Down Expand Up @@ -334,22 +330,19 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => {
{
position: GridPinnedColumnPosition.LEFT,
renderContext: leftRenderContext,
minFirstColumn: leftRenderContext.firstColumnIndex,
maxLastColumn: leftRenderContext.lastColumnIndex,
},
{ disableReorder: true },
)}
{getColumnHeaders({
renderContext,
minFirstColumn: pinnedColumns.left.length,
maxLastColumn: visibleColumns.length - pinnedColumns.right.length,
})}
{rightRenderContext &&
getColumnHeaders(
{
position: GridPinnedColumnPosition.RIGHT,
renderContext: rightRenderContext,
minFirstColumn: rightRenderContext.firstColumnIndex,
maxLastColumn: rightRenderContext.lastColumnIndex,
},
{
Expand Down Expand Up @@ -499,7 +492,6 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => {
params: {
position: GridPinnedColumnPosition.LEFT,
renderContext: leftRenderContext,
minFirstColumn: leftRenderContext.firstColumnIndex,
maxLastColumn: leftRenderContext.lastColumnIndex,
},
})}
Expand All @@ -510,7 +502,6 @@ export const useGridColumnHeaders = (props: UseGridColumnHeadersProps) => {
params: {
position: GridPinnedColumnPosition.RIGHT,
renderContext: rightRenderContext,
minFirstColumn: rightRenderContext.firstColumnIndex,
maxLastColumn: rightRenderContext.lastColumnIndex,
},
})}
Expand Down

0 comments on commit edc76e0

Please sign in to comment.