package.build.lib.utils.getPaginationRowModel.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of table-core Show documentation
Show all versions of table-core Show documentation
Headless UI for building powerful tables & datagrids for TS/JS.
The newest version!
{"version":3,"file":"getPaginationRowModel.js","sources":["../../../src/utils/getPaginationRowModel.ts"],"sourcesContent":["import { Table, RowModel, Row, RowData } from '../types'\nimport { memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n )\n}\n"],"names":["getPaginationRowModel","opts","table","memo","getState","pagination","getPrePaginationRowModel","options","paginateExpandedRows","undefined","expanded","rowModel","rows","length","pageSize","pageIndex","flatRows","rowsById","pageStart","pageEnd","slice","paginatedRowModel","expandRows","handleRow","row","push","subRows","forEach","key","process","env","NODE_ENV","debug","_table$options$debugA","debugAll","debugTable"],"mappings":";;;;;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