package.build.lib.utils.getExpandedRowModel.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":"getExpandedRowModel.js","sources":["../../../src/utils/getExpandedRowModel.ts"],"sourcesContent":["import { Table, Row, RowModel, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n"],"names":["getExpandedRowModel","table","memo","getState","expanded","getPreExpandedRowModel","options","paginateExpandedRows","rowModel","rows","length","Object","keys","expandRows","key","process","env","NODE_ENV","debug","_table$options$debugA","debugAll","debugTable","expandedRows","handleRow","row","_row$subRows","push","subRows","getIsExpanded","forEach","flatRows","rowsById"],"mappings":";;;;;;;;;;;;;;;;AAGO,SAASA,mBAAmBA,GAER;AACzB,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CACJD,KAAK,CAACE,QAAQ,EAAE,CAACC,QAAQ,EACzBH,KAAK,CA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