UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

42 lines (41 loc) 1.94 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { useConfig } from "../../../context/ConfigContext.mjs"; import useDataColumns_mjs_default from "../../../hooks/useDataColumns.mjs"; import { DataTable } from "../../DataTable.mjs"; import useLocalPagination_mjs_default from "../../../hooks/useLocalPagination.mjs"; import { Pagination } from "../../Pagination.mjs"; const MultiSelectDisplayTable = ({ formData, schema, deletable, onRemoveClick, pagination, rawData })=>{ const { resourcesIdProperty } = useConfig(); const { dataToRender, handlePageChange, totalPages, pageIndex } = useLocalPagination_mjs_default(formData, pagination ? pagination.perPage ?? 20 : void 0); const columns = useDataColumns_mjs_default({ data: dataToRender?.map((data)=>data.data), sortable: false, resourcesIdProperty: resourcesIdProperty, resource: schema.items?.relation, rawData }); return formData?.map((data)=>data.data).length > 0 && /*#__PURE__*/ jsxs("div", { className: "flex flex-col gap-2", children: [ /*#__PURE__*/ jsx(DataTable, { columns: columns, data: dataToRender?.map((data)=>data.data), resource: schema.items?.relation, resourcesIdProperty: resourcesIdProperty, rowSelection: {}, deletable: deletable, onRemoveClick: onRemoveClick }), !!pagination && /*#__PURE__*/ jsx("div", { className: "self-end", children: /*#__PURE__*/ jsx(Pagination, { currentPageIndex: pageIndex, totalPageCount: totalPages, onPageChange: handlePageChange }) }) ] }); }; const MultiSelect_MultiSelectDisplayTable = MultiSelectDisplayTable; export { MultiSelect_MultiSelectDisplayTable as default };