UNPKG

react-smart-data-table

Version:

A smart data table component for React.js meant to be configuration free

37 lines (36 loc) 1.08 kB
import type { Column, Headers, UnknownObject } from '../helpers/functions'; import TableAction from '../helpers/table-action.enum'; export type TableReducerAction<T = UnknownObject> = { type: TableAction.FetchStart; } | { type: TableAction.FetchSuccess; asyncData: T[]; columns: Column<T>[]; } | { type: TableAction.FetchError; } | { type: TableAction.SetSorting; column: Column<T>; } | { type: TableAction.SetActivePage; activePage: number; } | { type: TableAction.ToggleColumn; key: string; } | { type: TableAction.ToggleAllColumns; columns: Column<T>[]; isChecked: boolean; } | { type: TableAction.ResetPageForFilter; filterValue: string; }; export declare function useTableReducer<T = UnknownObject>(initialColProperties?: Headers<T>): [{ colProperties: Headers<T>; activePage: number; asyncData: T[]; columns: Column<T>[]; isLoading: boolean; prevFilterValue: string; sorting: import("../helpers/functions").Sorting; }, import("react").ActionDispatch<[action: TableReducerAction<T>]>];