20 lines
752 B
TypeScript
20 lines
752 B
TypeScript
import { MRT_RowData, MRT_TableInstance, MRT_TableOptions, useMantineReactTable } from "mantine-react-table";
|
|
import { NejReactTableOptions, TableInstance } from "./NejReactTable";
|
|
|
|
|
|
export const useNejReactTable = <TData extends MRT_RowData>(
|
|
tableOptions: NejReactTableOptions<TData>,
|
|
): TableInstance<TData> => {
|
|
return {
|
|
...useMantineReactTable({
|
|
enablePagination: false,
|
|
enableFullScreenToggle: false,
|
|
enableDensityToggle: false,
|
|
enableBottomToolbar: false,
|
|
enableTopToolbar: tableOptions.renderTopToolbarCustomActions != null,
|
|
...tableOptions,
|
|
data: tableOptions.data ?? [],
|
|
}),
|
|
loading: tableOptions.data == null
|
|
};
|
|
} |