Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ Primary.args = {
props: {
className: '',
},
info: {
tooltip: 'More information about Kind',
tooltipProps: {
isContentLeftAligned: true,
},
},
},
{
title: 'Labels',
Expand Down
6 changes: 5 additions & 1 deletion packages/lib-utils/src/components/table/VirtualizedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ const VirtualizedTable: React.FC<VirtualizedTableProps<AnyObject>> = ({
}}
/>
{columns.map(
({ title, props: properties, sort, transforms, visibility, id }, columnIndex) => {
(
{ title, props: properties, sort, transforms, visibility, id, info },
columnIndex,
) => {
const isSortable = !!transforms?.find((item) => item?.name === 'sortable');
const defaultSort = {
sortBy: {
Expand All @@ -186,6 +189,7 @@ const VirtualizedTable: React.FC<VirtualizedTableProps<AnyObject>> = ({
<Th
// eslint-disable-next-line react/no-array-index-key
key={`column-${columnIndex}-${id}`}
info={info}
sort={isSortable ? defaultSort : sort}
visibility={visibility}
// eslint-disable-next-line react/jsx-props-no-spreading
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Td } from '@patternfly/react-table';
import type { ICell, SortByDirection, ThProps } from '@patternfly/react-table';
import type { ThInfoType } from '@patternfly/react-table/dist/esm/components/Table/base';
import { VirtualTableBody } from '@patternfly/react-virtualized-extension';
import type { Scroll } from '@patternfly/react-virtualized-extension/dist/js/components/Virtualized/types';
import * as React from 'react';
Expand All @@ -20,6 +21,8 @@ export type TableColumn<D> = ICell & {
sort?: ((data: D[], sortDirection: SortByDirection) => D[]) | ThProps['sort'] | string;
/** Optional visibility. */
visibility?: string[];
/** Optional info tooltip or popover. */
info?: ThInfoType;
};

export type TableRowProps = {
Expand Down