// Type definitions for react-bootstrap-table2-toolkit 2.1 // Project: https://github.com/react-bootstrap-table/react-bootstrap-table2#readme // Definitions by: Wlad Meixner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 // documentation taken from https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/table-props.html import { CSSProperties, ReactNode } from 'react'; import { ColumnDescription } from 'react-bootstrap-table-next'; /** * declaration for table toolkit sub module */ export interface InjectedSearchProps { searchText: string; onSearch: (val: string) => void; onClear: () => void; } export interface SearchMatchProps { searchText: string; value: string; column: ColumnDescription; row: T; } export interface TableSearchProps { searchFormatted?: boolean; defaultSearch?: string; placeholder?: string; onColumnMatch?: (props: SearchMatchProps) => void; customMatchFunc?: (props: SearchMatchProps) => boolean; } export interface TableToolkitProps { bootstrap4?: boolean; search?: TableSearchProps | boolean; keyField: keyof T | string; data: T[]; ref?: any; columns: Array>; children: (props: ToolkitContextType) => JSX.Element; } export interface ToolkitContextType { searchProps: InjectedSearchProps; csvProps: { onExport: () => void; }; columnToggleProps: { columns: ColumnDescription[]; /** * array of toggled columns */ toggles: boolean[]; onColumnToggle: (dataField: string) => void; }; baseProps: { /** * table key field */ keyField: any; columns: ColumnDescription[]; data: any[]; bootstrap4?: boolean; }; } export interface ToggleListProps { columns: ColumnDescription[]; /** * array of toggled columns */ toggles: boolean[]; onColumnToggle: (dataField: string) => void; btnClassName?: string; className?: string; contextual?: string; } export namespace ColumnToggle { function ToggleList(props: ToggleListProps): React.ReactElement | null; } export interface ExportCSVButtonProps { children: ReactNode; onExport: () => void; style?: CSSProperties; className?: string; } export namespace CSVExport { function ToggleList(props: ExportCSVButtonProps): React.ReactElement | null; } export interface SearchBarProps { onSearch: (searchText: string) => void; className?: string; placeholder?: string; style?: CSSProperties; delay?: number; searchText?: string; tableId?: string; } export interface ClearSearchButtonProps { onClear?: () => void; className?: string; text?: string; } export namespace Search { function SearchBar(props: SearchBarProps): React.ReactElement | null; function ClearSearchButton(props: ExportCSVButtonProps): React.ReactElement | null; } export const ToolkitContext: React.Context; declare function ToolkitProvider(props: TableToolkitProps): React.ReactElement | null; export default ToolkitProvider;