import {IDatatable} from "../interfaces/datatable.interface"; import {IHeader} from "../interfaces/header.interface"; import {IAction} from "../interfaces/action.interface"; import {FormCheck, OverlayTrigger, Tooltip} from "react-bootstrap"; import {useEffect, useState} from "react"; export const Datatable = ({ headers = [], actions = [], items = [], page = 1, limit = 15, className = '', rowClasses = '', rowStyles = {}, hasCheckbox = false, hasIndexNumbers = true, loading = false, loaderComponent =
# | } {hasCheckbox &&
| }
{headers
.filter(({hidden}: any) => !hidden)
.map((header: IHeader, index: number) => {header.title} | )} {actions?.length > 0 &&} |
---|---|---|---|
{(page - 1) * limit + idx + 1} | } {hasCheckbox &&
| }
{headers.filter(({hidden}: any) => !hidden).map((header: IHeader, index: number) =>
{item[header.key]} | )} {actions?.length > 0 &&
{actions.map((btn: IAction, index: number) =>
| }