///
export interface Icolumn {
field: string;
use?: string;
use_in_search?: boolean;
use_in_display?: boolean;
use_in_export?: boolean;
}
export declare type Irow = Record;
/**
* A function whose return value is either a JSX element or a string
*/
export declare type renderFunction = (row: Irow, col: Icolumn, display_value: string) => JSX.Element | string;
/**
* A function when invoked, returns a string.
*/
export declare type stringRenderFunc = (row: Irow, col: Icolumn, display_value: string) => string;
export interface Iprop {
rows: Irow[];
columns: Icolumn[];
per_page?: number;
no_content_text?: string;
debounce_search?: number;
table_header?: string;
show_search?: boolean;
should_export?: boolean;
export_text?: string;
bulk_select_options?: string[];
bulk_select_button_text?: string;
export_csv_file?: string;
striped?: boolean;
bordered?: boolean;
hovered?: boolean;
row_render?: renderFunction;
on_search?: (search_word: string, result?: Irow[] | []) => void;
/**
* A function used in modifying a row member before it is used for downloading an excel sheet
*/
export_modify?: stringRenderFunc;
on_bulk_action?: (selected_option: string, selected: Irow[]) => void;
styling?: ItableStyle;
}
export interface ItableStyle {
base_bg_color?: string;
base_text_color?: string;
main?: string;
top?: ItableTop;
table_head?: {
table_row?: string;
table_data?: string;
};
table_body?: {
main?: string;
table_row?: string;
table_data?: string;
};
footer?: {
main?: string;
statistics?: {
main?: string;
bold_numbers?: string;
};
page_numbers?: string;
};
}
export interface ItableTop {
title?: string;
elements?: {
main?: string;
search?: string;
bulk_select?: {
main?: string;
button?: string;
};
export?: string;
};
}
export interface Istate {
/**
* The rows currently being shown on the table or rows for the current active page number
*/
active_rows: Irow[] | [];
/**
* All page numbers are stored in an array
*/
page_number_list: number[];
/**
* Holds the current active page number
*/
active_page_number: number;
/**
* An `OBJECT MAP` whose key is each page number and points to
* the
*/
paginated_map: IPaginated;
/**
* A number that holds the count of all rows
*/
total_rows_count: number;
}
export interface ItableLinks {
/**
* An array to store the page numbers
*/
page_number_list: number[];
/**
* An `OBJECT MAP` whose key is each page number and points to
* the `IperPage` data for the page.
*/
page_map: IPaginated;
/**
* a count of the pages just iterated
*/
total_data_count: number;
}
/**
* `Record like` Interface describing how the object holding each page data will look like
*/
export interface IPaginated {
[key: number]: IPerPage;
}
export interface IretainPage {
active_number: number;
page_map?: IPaginated;
}
export interface IPerPage {
/**
* All row data for this page
*/
page_row_array: Irow[];
/**
* If this page is active, can the pagination back button be clickable ?
*/
back_button_clickable: boolean;
/**
* If this page is active, can the Forward pagination button be clickable ?
*/
forward_button_clickable: boolean;
is_active: boolean;
/**
* The array index this records starts from
*/
from_index: number;
/**
* A set that holds the index of all rows that a marked as checked(selected) for bulk
* actions on this page. This holds data each page(paginated rows). This means if there are 20 pages, each page will have
* its own `Set`, this 20 Sets in `ItableLinks.page_map` data
*/
checked_set: Set;
}