@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
45 lines (44 loc) • 1.72 kB
TypeScript
import { ColumnSort, SortingState, Table } from '@tanstack/react-table';
import { Dispatch, ReactNode, SetStateAction } from 'react';
import { RowData } from '../VirtualizedTable.types';
export type ContextType<TData extends RowData = RowData> = {
sortedData: ColumnSort[];
table: Table<TData>;
pageSize: number;
tableFetching?: boolean;
tableLoading?: boolean;
totalItems?: number;
termOfSearch?: string;
page: number;
multiselectSelected?: Record<string, string[]>;
dateFilters?: Record<string, string | undefined>;
dateRangeFilters?: Record<string, {
from?: string;
to?: string;
} | undefined>;
timeFilters?: Record<string, string | undefined>;
totalPages: number;
isFirstLoad: boolean;
enableExpandedRow?: boolean;
classNameExpandedRow?: string;
classNameExpandedCell?: string;
classNameExpandedContent?: string;
classNameActiveExpandedRow?: string;
enableHoverRow?: boolean;
classNameHoverRow?: string;
isBorderOnAdjacentCell?: boolean;
isExpandColumnVisible?: boolean;
renderExpandedRow?: (data: RowData) => ReactNode;
handlePage: (newPage: number) => void;
onPageSize: (newPageSize: number) => void;
onSorting: Dispatch<SetStateAction<SortingState>>;
onChangeTermOfSearch: (term: string) => void;
onSelectMultiselect: (key: string, selectedValues: string[]) => void;
onSelectDateFilter: (key: string, date?: Date) => void;
onSelectDateRangeFilter: (key: string, range?: {
from?: Date;
to?: Date;
}) => void;
onSelectTimeFilter: (key: string, time?: Date) => void;
};
export declare const TableContext: import('react').Context<ContextType<unknown>>;