Skip to content

Commit

Permalink
fix(table): add filter boolean for no show order indicator in filters
Browse files Browse the repository at this point in the history
  • Loading branch information
santiago.trigo committed Oct 23, 2024
1 parent 04261b8 commit 82109b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/table/src/core/HeaderCell/HeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface HeaderCellProps {
offsetX: number;
children: React.ReactNode;
title?: string;
filter?: boolean;
}

export const HeaderCell: React.FC<HeaderCellProps> = ({
Expand All @@ -21,8 +22,9 @@ export const HeaderCell: React.FC<HeaderCellProps> = ({
offsetX,
children,
title,
filter
}) => {
const { density, onSort, resizableColumns, showFilters } = React.useContext(TableContext);
const { density, onSort, resizableColumns } = React.useContext(TableContext);

return (
<StyledHeaderCell
Expand All @@ -42,7 +44,7 @@ export const HeaderCell: React.FC<HeaderCellProps> = ({
}
>
{children}
{colDef.sortable && !showFilters && <OrderIndicator colDef={colDef} />}
{colDef.sortable && !filter && <OrderIndicator colDef={colDef} />}
{(colDef?.resizable ?? resizableColumns) && (
<StyledHeaderCellResizer
$density={density}
Expand Down
1 change: 1 addition & 0 deletions packages/table/src/core/TableHead/TableHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const TableHead: React.FC<TableHeadProps> = ({
colDef={colDef}
width={virtualColumn ? `${virtualColumn.size}px` : 'auto'}
offsetX={virtualColumn ? virtualColumn.start : undefined}
filter={true}
>
{colDef?.headerOnFilterPosition ? (
colDef?.headerRenderer ? (
Expand Down
1 change: 1 addition & 0 deletions packages/table/stories/column/Order.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const OrderTable = () => {
editable: false,
sortable: true,
}}
showFilters
colDefs={updateColDefsWithOrderStruct(colDefs, orderStruct)}
data={dataOrdered}
/>
Expand Down

0 comments on commit 82109b2

Please sign in to comment.