norma-library
Version:
Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.
71 lines (63 loc) • 1.48 kB
text/typescript
import { ColumnDef } from '@tanstack/react-table'
import { JSX } from 'react'
type Labels = {
orderAsc?: string
orderDesc?: string
filter?: string
clearFilter?: string
columns?: string
}
interface Pagination {
pageIndex: number
pageSize: number
}
interface Sticky {
enabled: boolean
top: number
}
export interface TableList {
id: string
label: string | JSX.Element
onClick?: (id: string) => void
checked?: () => boolean | boolean
disabled?: boolean
}
export interface TableButton {
render: () => JSX.Element
list?: {
options: TableList[]
toggleableList?: boolean
closeOnClick?: boolean
}
disabled?: boolean
onClick?: () => void
}
export interface UncontrolledTableProps {
data: any
columns: ColumnDef<ColumnsTable>[]
pagination?: Pagination
totalPages?: number
labels?: Labels
tableClassName?: string
sticky?: Sticky
draggable?: boolean
buttons?: TableButton[]
configs?: TableButton[]
hideColumns?: string[]
onClick?: () => void
onMouseOver?: () => void
onMouseOut?: () => void
onColumnVisibilityChange?: (column: string, value: boolean) => void
onChangePage?: (pagination: Pagination) => void
onFilterClick?: (column: string) => void
onSortClick?: (column: string, direction: string) => void
onDragEnd?: (data: any[]) => void
}
export interface ColumnsTable {
header: string
accessorKey: string
type: string
enableColumnFilter: boolean
filterFn: string
nofilter?: boolean
}