Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] Remove minFirstColumn from GetHeadersParams interface #14450

Merged
merged 9 commits into from
Sep 18, 2024
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
Loading