import { ButtonVariant, PerPageOptions } from '@patternfly/react-core'; import { IRow, ISortBy, ITransform, TableGridBreakpoint } from '@patternfly/react-table'; import React, { ReactNode } from 'react'; declare type SortFn = (a: T, b: T) => number; declare type CellFn = (item: T) => ReactNode; declare type SearchFn = (item: T) => string | boolean | number | string[] | boolean[] | number[]; export interface IAcmTableColumn { /** the header of the column */ header: string; tooltip?: string; /** enables sort either on field name of using sort function */ sort?: SortFn | string; /** if defined will enable search of the search field */ search?: SearchFn | string; /** cell content, either on field name of using cell function */ cell: CellFn | string; transforms?: ITransform[]; cellTransforms?: ITransform[]; } export interface IAcmTableAction { id: string; title: string | React.ReactNode; click: () => void; isDisabled?: boolean | undefined; tooltip?: string | React.ReactNode; variant?: ButtonVariant; } export interface IAcmTableDropdown { id: string; isDisabled?: boolean | undefined; toggleText: string | React.ReactNode; disableText?: string | React.ReactNode; actions: IAcmTableDropdownAction[]; } export interface IAcmTableDropdownAction { id: string; isDisabled?: boolean | undefined; component?: string; children: string | React.ReactNode; disableText?: string | React.ReactNode; } export interface IAcmRowAction { /** Action identifier */ id: string; /** Display a tooltip for this action */ tooltip?: string; /** Inject a separator horizontal rule immediately before an action */ addSeparator?: boolean; /** Display an action as being disabled */ isDisabled?: boolean; /** Visible text for action */ title: string | React.ReactNode; /** Function for onClick() action */ click: (item: T) => void; } export interface IAcmTableBulkAction { id: string; title: string | React.ReactNode; click: (items: T[]) => void; isDisabled?: boolean; tooltip?: string | React.ReactNode; } export declare function AcmTablePaginationContextProvider(props: { children: ReactNode; localStorageKey: string; }): JSX.Element; export interface AcmTableProps { plural: string; items?: T[]; addSubRows?: (item: T) => IRow[] | undefined; initialSelectedItems?: T[]; columns: IAcmTableColumn[]; keyFn: (item: T) => string; groupFn?: (item: T) => string | null; groupSummaryFn?: (items: T[]) => IRow; tableActions?: IAcmTableAction[]; tableDropdown?: IAcmTableDropdown; rowActions?: IAcmRowAction[]; rowActionResolver?: (item: T) => IAcmRowAction[]; bulkActions?: IAcmTableBulkAction[]; extraToolbarControls?: ReactNode; emptyState?: ReactNode; onSelect?: (items: T[]) => void; page?: number; setPage?: (page: number) => void; search?: string; setSearch?: (search: string) => void; searchPlaceholder?: string; initialSort?: ISortBy | undefined; sort?: ISortBy | undefined; setSort?: (sort: ISortBy | undefined) => void; showToolbar?: boolean; gridBreakPoint?: TableGridBreakpoint; perPageOptions?: PerPageOptions[]; autoHidePagination?: boolean; noBorders?: boolean; fuseThreshold?: number; } export declare function AcmTable(props: AcmTableProps): JSX.Element; export declare function compareItems(path: string): (a: unknown, b: unknown) => 0 | 1 | -1; export declare function compareUnknowns(a: unknown | undefined | null, b: unknown | undefined | null): 0 | 1 | -1; export declare function compareStrings(a: string | undefined | null, b: string | undefined | null): 0 | 1 | -1; export declare function compareNumbers(a: number | undefined | null, b: number | undefined | null): 0 | 1 | -1; export {};