@tanstack/table-core 8.5.9 → 8.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,8 @@
12
12
 
13
13
  Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
+ var utils = require('../utils.js');
16
+
15
17
  function createCell(table, row, column, columnId) {
16
18
  const getRenderValue = () => {
17
19
  var _cell$getValue;
@@ -25,13 +27,16 @@ function createCell(table, row, column, columnId) {
25
27
  column,
26
28
  getValue: () => row.getValue(columnId),
27
29
  renderValue: getRenderValue,
28
- getContext: () => ({
30
+ getContext: utils.memo(() => [table, column, row, cell], (table, column, row, cell) => ({
29
31
  table,
30
32
  column,
31
33
  row,
32
34
  cell: cell,
33
35
  getValue: cell.getValue,
34
36
  renderValue: cell.renderValue
37
+ }), {
38
+ key: process.env.NODE_ENV === 'development' && 'cell.getContext',
39
+ debug: () => table.options.debugAll
35
40
  })
36
41
  };
37
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"cell.js","sources":["../../../src/core/cell.ts"],"sourcesContent":["import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter } from '../utils'\n\nexport type CellContext<TData extends RowData, TValue> = {\n table: Table<TData>\n column: Column<TData, TValue>\n row: Row<TData>\n cell: Cell<TData, TValue>\n getValue: Getter<TValue>\n renderValue: Getter<TValue | null>\n}\n\nexport type CoreCell<TData extends RowData, TValue> = {\n id: string\n getValue: CellContext<TData, TValue>['getValue']\n renderValue: CellContext<TData, TValue>['renderValue']\n row: Row<TData>\n column: Column<TData, TValue>\n getContext: () => CellContext<TData, TValue>\n}\n\nexport function createCell<TData extends RowData, TValue>(\n table: Table<TData>,\n row: Row<TData>,\n column: Column<TData, TValue>,\n columnId: string\n) {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell<TData, TValue> = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: () => ({\n table,\n column,\n row,\n cell: cell as Cell<TData, TValue>,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n }\n\n table._features.forEach(feature => {\n Object.assign(\n cell,\n feature.createCell?.(\n cell as Cell<TData, TValue>,\n column,\n row as Row<TData>,\n table\n )\n )\n }, {})\n\n return cell as Cell<TData, TValue>\n}\n"],"names":["createCell","table","row","column","columnId","getRenderValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","_features","forEach","feature","Object","assign"],"mappings":";;;;;;;;;;;;;;AAqBO,SAASA,UAAT,CACLC,KADK,EAELC,GAFK,EAGLC,MAHK,EAILC,QAJK,EAKL;AACA,EAAA,MAAMC,cAAc,GAAG,MAAA;AAAA,IAAA,IAAA,cAAA,CAAA;;IAAA,OACrBC,CAAAA,cAAAA,GAAAA,IAAI,CAACC,QAAL,EADqB,6BACFN,KAAK,CAACO,OAAN,CAAcC,mBADZ,CAAA;GAAvB,CAAA;;AAGA,EAAA,MAAMH,IAA6B,GAAG;AACpCI,IAAAA,EAAE,EAAKR,GAAG,CAACQ,EAAT,GAAeP,GAAAA,GAAAA,MAAM,CAACO,EADY;IAEpCR,GAFoC;IAGpCC,MAHoC;AAIpCI,IAAAA,QAAQ,EAAE,MAAML,GAAG,CAACK,QAAJ,CAAaH,QAAb,CAJoB;AAKpCO,IAAAA,WAAW,EAAEN,cALuB;AAMpCO,IAAAA,UAAU,EAAE,OAAO;MACjBX,KADiB;MAEjBE,MAFiB;MAGjBD,GAHiB;AAIjBI,MAAAA,IAAI,EAAEA,IAJW;MAKjBC,QAAQ,EAAED,IAAI,CAACC,QALE;MAMjBI,WAAW,EAAEL,IAAI,CAACK,WAAAA;KANR,CAAA;GANd,CAAA;;AAgBAV,EAAAA,KAAK,CAACY,SAAN,CAAgBC,OAAhB,CAAwBC,OAAO,IAAI;IACjCC,MAAM,CAACC,MAAP,CACEX,IADF,EAEES,OAAO,CAACf,UAFV,IAEEe,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAACf,UAAR,CACEM,IADF,EAEEH,MAFF,EAGED,GAHF,EAIED,KAJF,CAFF,CAAA,CAAA;AASD,GAVD,EAUG,EAVH,CAAA,CAAA;;AAYA,EAAA,OAAOK,IAAP,CAAA;AACD;;;;"}
1
+ {"version":3,"file":"cell.js","sources":["../../../src/core/cell.ts"],"sourcesContent":["import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, memo } from '../utils'\n\nexport type CellContext<TData extends RowData, TValue> = {\n table: Table<TData>\n column: Column<TData, TValue>\n row: Row<TData>\n cell: Cell<TData, TValue>\n getValue: Getter<TValue>\n renderValue: Getter<TValue | null>\n}\n\nexport type CoreCell<TData extends RowData, TValue> = {\n id: string\n getValue: CellContext<TData, TValue>['getValue']\n renderValue: CellContext<TData, TValue>['renderValue']\n row: Row<TData>\n column: Column<TData, TValue>\n getContext: () => CellContext<TData, TValue>\n}\n\nexport function createCell<TData extends RowData, TValue>(\n table: Table<TData>,\n row: Row<TData>,\n column: Column<TData, TValue>,\n columnId: string\n) {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell<TData, TValue> = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell<TData, TValue>,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n {\n key: process.env.NODE_ENV === 'development' && 'cell.getContext',\n debug: () => table.options.debugAll,\n }\n ),\n }\n\n table._features.forEach(feature => {\n Object.assign(\n cell,\n feature.createCell?.(\n cell as Cell<TData, TValue>,\n column,\n row as Row<TData>,\n table\n )\n )\n }, {})\n\n return cell as Cell<TData, TValue>\n}\n"],"names":["createCell","table","row","column","columnId","getRenderValue","cell","getValue","options","renderFallbackValue","id","renderValue","getContext","memo","key","process","env","NODE_ENV","debug","debugAll","_features","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B,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAACtB,UAAR,CACEM,IADF,EAEEH,MAFF,EAGED,GAHF,EAIED,KAJF,CAFF,CAAA,CAAA;AASD,GAVD,EAUG,EAVH,CAAA,CAAA;;AAYA,EAAA,OAAOK,IAAP,CAAA;AACD;;;;"}
@@ -22,7 +22,6 @@ function getExpandedRowModel() {
22
22
 
23
23
  if (!paginateExpandedRows) {
24
24
  // Only expand rows at this point if they are being paginated
25
- console.log(rowModel.rows);
26
25
  return rowModel;
27
26
  }
28
27
 
@@ -1 +1 @@
1
- {"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<TData extends RowData>(): (\n table: Table<TData>\n) => () => RowModel<TData> {\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 console.log(rowModel.rows)\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<TData extends RowData>(rowModel: RowModel<TData>) {\n const expandedRows: Row<TData>[] = []\n\n const handleRow = (row: Row<TData>) => {\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","console","log","expandRows","key","process","env","NODE_ENV","debug","debugAll","debugTable","expandedRows","handleRow","row","push","subRows","getIsExpanded","forEach","flatRows","rowsById"],"mappings":";;;;;;;;;;;;;;;;AAGO,SAASA,mBAAT,GAEoB;AACzB,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CACJD,KAAK,CAACE,QAAN,EAAA,CAAiBC,QADb,EAEJH,KAAK,CAACI,sBAAN,EAFI,EAGJJ,KAAK,CAACK,OAAN,CAAcC,oBAHV,CADJ,EAMF,CAACH,QAAD,EAAWI,QAAX,EAAqBD,oBAArB,KAA8C;IAC5C,IACE,CAACC,QAAQ,CAACC,IAAT,CAAcC,MAAf,IACCN,QAAQ,KAAK,IAAb,IAAqB,CAACO,MAAM,CAACC,IAAP,CAAYR,QAAZ,IAAA,IAAA,GAAYA,QAAZ,GAAwB,EAAxB,CAA4BM,CAAAA,MAFrD,EAGE;AACA,MAAA,OAAOF,QAAP,CAAA;AACD,KAAA;;IAED,IAAI,CAACD,oBAAL,EAA2B;AACzB;AACAM,MAAAA,OAAO,CAACC,GAAR,CAAYN,QAAQ,CAACC,IAArB,CAAA,CAAA;AACA,MAAA,OAAOD,QAAP,CAAA;AACD,KAAA;;IAED,OAAOO,UAAU,CAACP,QAAD,CAAjB,CAAA;AACD,GArBC,EAsBF;IACEQ,GAAG,EAAEC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAAzB,IAA0C,qBADjD;AAEEC,IAAAA,KAAK,EAAE,MAAA;AAAA,MAAA,IAAA,qBAAA,CAAA;;MAAA,OAAMnB,CAAAA,qBAAAA,GAAAA,KAAK,CAACK,OAAN,CAAce,QAApB,oCAAgCpB,KAAK,CAACK,OAAN,CAAcgB,UAA9C,CAAA;AAAA,KAAA;AAFT,GAtBE,CADN,CAAA;AA4BD,CAAA;AAEM,SAASP,UAAT,CAA2CP,QAA3C,EAAsE;EAC3E,MAAMe,YAA0B,GAAG,EAAnC,CAAA;;EAEA,MAAMC,SAAS,GAAIC,GAAD,IAAqB;AAAA,IAAA,IAAA,YAAA,CAAA;;IACrCF,YAAY,CAACG,IAAb,CAAkBD,GAAlB,CAAA,CAAA;;IAEA,IAAI,CAAA,YAAA,GAAAA,GAAG,CAACE,OAAJ,KAAA,IAAA,IAAA,YAAA,CAAajB,MAAb,IAAuBe,GAAG,CAACG,aAAJ,EAA3B,EAAgD;AAC9CH,MAAAA,GAAG,CAACE,OAAJ,CAAYE,OAAZ,CAAoBL,SAApB,CAAA,CAAA;AACD,KAAA;GALH,CAAA;;AAQAhB,EAAAA,QAAQ,CAACC,IAAT,CAAcoB,OAAd,CAAsBL,SAAtB,CAAA,CAAA;EAEA,OAAO;AACLf,IAAAA,IAAI,EAAEc,YADD;IAELO,QAAQ,EAAEtB,QAAQ,CAACsB,QAFd;IAGLC,QAAQ,EAAEvB,QAAQ,CAACuB,QAAAA;GAHrB,CAAA;AAKD;;;;;"}
1
+ {"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<TData extends RowData>(): (\n table: Table<TData>\n) => () => RowModel<TData> {\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<TData extends RowData>(rowModel: RowModel<TData>) {\n const expandedRows: Row<TData>[] = []\n\n const handleRow = (row: Row<TData>) => {\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","debugAll","debugTable","expandedRows","handleRow","row","push","subRows","getIsExpanded","forEach","flatRows","rowsById"],"mappings":";;;;;;;;;;;;;;;;AAGO,SAASA,mBAAT,GAEoB;AACzB,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CACJD,KAAK,CAACE,QAAN,EAAA,CAAiBC,QADb,EAEJH,KAAK,CAACI,sBAAN,EAFI,EAGJJ,KAAK,CAACK,OAAN,CAAcC,oBAHV,CADJ,EAMF,CAACH,QAAD,EAAWI,QAAX,EAAqBD,oBAArB,KAA8C;IAC5C,IACE,CAACC,QAAQ,CAACC,IAAT,CAAcC,MAAf,IACCN,QAAQ,KAAK,IAAb,IAAqB,CAACO,MAAM,CAACC,IAAP,CAAYR,QAAZ,IAAA,IAAA,GAAYA,QAAZ,GAAwB,EAAxB,CAA4BM,CAAAA,MAFrD,EAGE;AACA,MAAA,OAAOF,QAAP,CAAA;AACD,KAAA;;IAED,IAAI,CAACD,oBAAL,EAA2B;AACzB;AACA,MAAA,OAAOC,QAAP,CAAA;AACD,KAAA;;IAED,OAAOK,UAAU,CAACL,QAAD,CAAjB,CAAA;AACD,GApBC,EAqBF;IACEM,GAAG,EAAEC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAAzB,IAA0C,qBADjD;AAEEC,IAAAA,KAAK,EAAE,MAAA;AAAA,MAAA,IAAA,qBAAA,CAAA;;MAAA,OAAMjB,CAAAA,qBAAAA,GAAAA,KAAK,CAACK,OAAN,CAAca,QAApB,oCAAgClB,KAAK,CAACK,OAAN,CAAcc,UAA9C,CAAA;AAAA,KAAA;AAFT,GArBE,CADN,CAAA;AA2BD,CAAA;AAEM,SAASP,UAAT,CAA2CL,QAA3C,EAAsE;EAC3E,MAAMa,YAA0B,GAAG,EAAnC,CAAA;;EAEA,MAAMC,SAAS,GAAIC,GAAD,IAAqB;AAAA,IAAA,IAAA,YAAA,CAAA;;IACrCF,YAAY,CAACG,IAAb,CAAkBD,GAAlB,CAAA,CAAA;;IAEA,IAAI,CAAA,YAAA,GAAAA,GAAG,CAACE,OAAJ,KAAA,IAAA,IAAA,YAAA,CAAaf,MAAb,IAAuBa,GAAG,CAACG,aAAJ,EAA3B,EAAgD;AAC9CH,MAAAA,GAAG,CAACE,OAAJ,CAAYE,OAAZ,CAAoBL,SAApB,CAAA,CAAA;AACD,KAAA;GALH,CAAA;;AAQAd,EAAAA,QAAQ,CAACC,IAAT,CAAckB,OAAd,CAAsBL,SAAtB,CAAA,CAAA;EAEA,OAAO;AACLb,IAAAA,IAAI,EAAEY,YADD;IAELO,QAAQ,EAAEpB,QAAQ,CAACoB,QAFd;IAGLC,QAAQ,EAAErB,QAAQ,CAACqB,QAAAA;GAHrB,CAAA;AAKD;;;;;"}
@@ -49,7 +49,6 @@ function getPaginationRowModel(opts) {
49
49
  };
50
50
  }
51
51
 
52
- console.log(paginatedRowModel.rows);
53
52
  paginatedRowModel.flatRows = [];
54
53
 
55
54
  const handleRow = row => {
@@ -1 +1 @@
1
- {"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<TData extends RowData>(opts?: {\n initialSync: boolean\n}): (table: Table<TData>) => () => RowModel<TData> {\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<TData>\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 console.log(paginatedRowModel.rows)\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row<TData>) => {\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","console","log","handleRow","row","push","subRows","forEach","key","process","env","NODE_ENV","debug","debugAll","debugTable"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAASA,qBAAT,CAAsDC,IAAtD,EAE4C;AACjD,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CACJD,KAAK,CAACE,QAAN,EAAA,CAAiBC,UADb,EAEJH,KAAK,CAACI,wBAAN,EAFI,EAGJJ,KAAK,CAACK,OAAN,CAAcC,oBAAd,GACIC,SADJ,GAEIP,KAAK,CAACE,QAAN,EAAiBM,CAAAA,QALjB,CADJ,EAQF,CAACL,UAAD,EAAaM,QAAb,KAA0B;AACxB,IAAA,IAAI,CAACA,QAAQ,CAACC,IAAT,CAAcC,MAAnB,EAA2B;AACzB,MAAA,OAAOF,QAAP,CAAA;AACD,KAAA;;IAED,MAAM;MAAEG,QAAF;AAAYC,MA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AEC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAAzB,IAA0C,uBADjD;AAEEC,IAAAA,KAAK,EAAE,MAAA;AAAA,MAAA,IAAA,qBAAA,CAAA;;MAAA,OAAMhC,CAAAA,qBAAAA,GAAAA,KAAK,CAACK,OAAN,CAAc4B,QAApB,oCAAgCjC,KAAK,CAACK,OAAN,CAAc6B,UAA9C,CAAA;AAAA,KAAA;AAFT,GAnDE,CADN,CAAA;AAyDD;;;;"}
1
+ {"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<TData extends RowData>(opts?: {\n initialSync: boolean\n}): (table: Table<TData>) => () => RowModel<TData> {\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<TData>\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<TData>) => {\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","debugAll","debugTable"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAASA,qBAAT,CAAsDC,IAAtD,EAE4C;AACjD,EAAA,OAAOC,KAAK,IACVC,UAAI,CACF,MAAM,CACJD,KAAK,CAACE,QAAN,EAAA,CAAiBC,UADb,EAEJH,KAAK,CAACI,wBAAN,EAFI,EAGJJ,KAAK,CAACK,OAAN,CAAcC,oBAAd,GACIC,SADJ,GAEIP,KAAK,CAACE,QAAN,EAAiBM,CAAAA,QALjB,CADJ,EAQF,CAACL,UAAD,EAAaM,QAAb,KAA0B;AACxB,IAAA,IAAI,CAACA,QAAQ,CAACC,IAAT,CAAcC,MAAnB,EAA2B;AACzB,MAAA,OAAOF,QAAP,CAAA;AACD,KAAA;;IAED,MAAM;MAAEG,QAAF;AAAYC,MAAAA,SAAAA;AAAZ,KAAA,GAA0BV,UAAhC,CAAA;IACA,IAAI;MAAEO,IAAF;MAAQI,QAAR;AAAkBC,MAAAA,QAAAA;AAAlB,KAAA,GAA+BN,QAAnC,CAAA;AACA,IAAA,MAAMO,SAAS,GAAGJ,QAAQ,GAAGC,SAA7B,CAAA;AACA,IAAA,MAAMI,OAAO,GAAGD,SAAS,GAAGJ,QAA5B,CAAA;IAEAF,IAAI,GAAGA,IAAI,CAACQ,KAAL,CAAWF,SAAX,EAAsBC,OAAtB,CAAP,CAAA;AAEA,IAAA,IAAIE,iBAAJ,CAAA;;AAEA,IAAA,IAAI,CAACnB,KAAK,CAACK,OAAN,CAAcC,oBAAnB,EAAyC;MACvCa,iBAAiB,GAAGC,8BAAU,CAAC;QAC7BV,IAD6B;QAE7BI,QAF6B;AAG7BC,QAAAA,QAAAA;AAH6B,OAAD,CAA9B,CAAA;AAKD,KAND,MAMO;AACLI,MAAAA,iBAAiB,GAAG;QAClBT,IADkB;QAElBI,QAFkB;AAGlBC,QAAAA,QAAAA;OAHF,CAAA;AAKD,KAAA;;IAEDI,iBAAiB,CAACL,QAAlB,GAA6B,EAA7B,CAAA;;IAEA,MAAMO,SAAS,GAAIC,GAAD,IAAqB;AACrCH,MAAAA,iBAAiB,CAACL,QAAlB,CAA2BS,IAA3B,CAAgCD,GAAhC,CAAA,CAAA;;AACA,MAAA,IAAIA,GAAG,CAACE,OAAJ,CAAYb,MAAhB,EAAwB;AACtBW,QAAAA,GAAG,CAACE,OAAJ,CAAYC,OAAZ,CAAoBJ,SAApB,CAAA,CAAA;AACD,OAAA;KAJH,CAAA;;AAOAF,IAAAA,iBAAiB,CAACT,IAAlB,CAAuBe,OAAvB,CAA+BJ,SAA/B,CAAA,CAAA;AAEA,IAAA,OAAOF,iBAAP,CAAA;AACD,GAhDC,EAiDF;IACEO,GAAG,EAAEC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAAzB,IAA0C,uBADjD;AAEEC,IAAAA,KAAK,EAAE,MAAA;AAAA,MAAA,IAAA,qBAAA,CAAA;;MAAA,OAAM9B,CAAAA,qBAAAA,GAAAA,KAAK,CAACK,OAAN,CAAc0B,QAApB,oCAAgC/B,KAAK,CAACK,OAAN,CAAc2B,UAA9C,CAAA;AAAA,KAAA;AAFT,GAjDE,CADN,CAAA;AAuDD;;;;"}
@@ -3051,13 +3051,16 @@ function createCell(table, row, column, columnId) {
3051
3051
  column,
3052
3052
  getValue: () => row.getValue(columnId),
3053
3053
  renderValue: getRenderValue,
3054
- getContext: () => ({
3054
+ getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({
3055
3055
  table,
3056
3056
  column,
3057
3057
  row,
3058
3058
  cell: cell,
3059
3059
  getValue: cell.getValue,
3060
3060
  renderValue: cell.renderValue
3061
+ }), {
3062
+ key: process.env.NODE_ENV === 'development' && 'cell.getContext',
3063
+ debug: () => table.options.debugAll
3061
3064
  })
3062
3065
  };
3063
3066
 
@@ -3789,7 +3792,6 @@ function getExpandedRowModel() {
3789
3792
 
3790
3793
  if (!paginateExpandedRows) {
3791
3794
  // Only expand rows at this point if they are being paginated
3792
- console.log(rowModel.rows);
3793
3795
  return rowModel;
3794
3796
  }
3795
3797
 
@@ -3858,7 +3860,6 @@ function getPaginationRowModel(opts) {
3858
3860
  };
3859
3861
  }
3860
3862
 
3861
- console.log(paginatedRowModel.rows);
3862
3863
  paginatedRowModel.flatRows = [];
3863
3864
 
3864
3865
  const handleRow = row => {