@tanstack/table-core 8.8.0 → 8.8.1

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.
@@ -4,6 +4,7 @@ export interface CoreRow<TData extends RowData> {
4
4
  index: number;
5
5
  original: TData;
6
6
  depth: number;
7
+ parentId?: string;
7
8
  _valuesCache: Record<string, unknown>;
8
9
  _uniqueValuesCache: Record<string, unknown>;
9
10
  getValue: <TValue>(columnId: string) => TValue;
@@ -14,6 +15,7 @@ export interface CoreRow<TData extends RowData> {
14
15
  originalSubRows?: TData[];
15
16
  getAllCells: () => Cell<TData, unknown>[];
16
17
  _getAllCellsByColumnId: () => Record<string, Cell<TData, unknown>>;
17
- parentRow?: Row<TData>;
18
+ getParentRow: () => Row<TData> | undefined;
19
+ getParentRows: () => Row<TData>[];
18
20
  }
19
- export declare const createRow: <TData extends unknown>(table: Table<TData>, id: string, original: TData, rowIndex: number, depth: number, subRows?: Row<TData>[] | undefined, parentRow?: Row<TData> | undefined) => Row<TData>;
21
+ export declare const createRow: <TData extends unknown>(table: Table<TData>, id: string, original: TData, rowIndex: number, depth: number, subRows?: Row<TData>[] | undefined, parentId?: string) => Row<TData>;
@@ -15,13 +15,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
15
15
  var utils = require('../utils.js');
16
16
  var cell = require('./cell.js');
17
17
 
18
- const createRow = (table, id, original, rowIndex, depth, subRows, parentRow) => {
18
+ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
19
19
  let row = {
20
20
  id,
21
21
  index: rowIndex,
22
22
  original,
23
23
  depth,
24
- parentRow,
24
+ parentId,
25
25
  _valuesCache: {},
26
26
  _uniqueValuesCache: {},
27
27
  getValue: columnId => {
@@ -56,6 +56,18 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentRow) =>
56
56
  },
57
57
  subRows: subRows != null ? subRows : [],
58
58
  getLeafRows: () => utils.flattenBy(row.subRows, d => d.subRows),
59
+ getParentRow: () => row.parentId ? table.getRow(row.parentId) : undefined,
60
+ getParentRows: () => {
61
+ let parentRows = [];
62
+ let currentRow = row;
63
+ while (true) {
64
+ const parentRow = currentRow.getParentRow();
65
+ if (!parentRow) break;
66
+ parentRows.push(parentRow);
67
+ currentRow = parentRow;
68
+ }
69
+ return parentRows.reverse();
70
+ },
59
71
  getAllCells: utils.memo(() => [table.getAllLeafColumns()], leafColumns => {
60
72
  return leafColumns.map(column => {
61
73
  return cell.createCell(table, row, column, column.id);
@@ -1 +1 @@
1
- {"version":3,"file":"row.js","sources":["../../../src/core/row.ts"],"sourcesContent":["import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow<TData extends RowData> {\n id: string\n index: number\n original: TData\n depth: number\n _valuesCache: Record<string, unknown>\n _uniqueValuesCache: Record<string, unknown>\n getValue: <TValue>(columnId: string) => TValue\n getUniqueValues: <TValue>(columnId: string) => TValue[]\n renderValue: <TValue>(columnId: string) => TValue\n subRows: Row<TData>[]\n getLeafRows: () => Row<TData>[]\n originalSubRows?: TData[]\n getAllCells: () => Cell<TData, unknown>[]\n _getAllCellsByColumnId: () => Record<string, Cell<TData, unknown>>\n parentRow?: Row<TData>\n}\n\nexport const createRow = <TData extends RowData>(\n table: Table<TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row<TData>[],\n parentRow?: Row<TData>\n): Row<TData> => {\n let row: CoreRow<TData> = {\n id,\n index: rowIndex,\n original,\n depth,\n parentRow,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row<TData>, column, column.id)\n })\n },\n {\n key: process.env.NODE_ENV === 'development' && 'row.getAllCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce((acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n }, {} as Record<string, Cell<TData, unknown>>)\n },\n {\n key:\n process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n Object.assign(row, feature?.createRow?.(row, table))\n }\n\n return row as Row<TData>\n}\n"],"names":["createRow","table","id","original","rowIndex","depth","subRows","parentRow","row","index","_valuesCache","_uniqueValuesCache","getValue","columnId","hasOwnProperty","column","getColumn","accessorFn","undefined","getUniqueValues","columnDef","renderValue","_row$getValue","options","renderFallbackValue","getLeafRows","flattenBy","d","getAllCells","memo","getAllLeafColumns","leafColumns","map","createCell","key","process","env","NODE_ENV","debug","_table$options$debugA","debugAll","debugRows","_getAllCellsByColumnId","allCells","reduce","acc","cell","_table$options$debugA2","i","_features","length","feature","Object","assign"],"mappings":";;;;;;;;;;;;;;;;;MAsBaA,SAAS,GA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AlBmD,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAAEnD,SAAS,CAAGQ,GAAG,EAAEP,KAAK,CAAC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,OAAOO,GAAG,CAAA;AACZ;;;;"}
1
+ {"version":3,"file":"row.js","sources":["../../../src/core/row.ts"],"sourcesContent":["import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow<TData extends RowData> {\n id: string\n index: number\n original: TData\n depth: number\n parentId?: string\n _valuesCache: Record<string, unknown>\n _uniqueValuesCache: Record<string, unknown>\n getValue: <TValue>(columnId: string) => TValue\n getUniqueValues: <TValue>(columnId: string) => TValue[]\n renderValue: <TValue>(columnId: string) => TValue\n subRows: Row<TData>[]\n getLeafRows: () => Row<TData>[]\n originalSubRows?: TData[]\n getAllCells: () => Cell<TData, unknown>[]\n _getAllCellsByColumnId: () => Record<string, Cell<TData, unknown>>\n getParentRow: () => Row<TData> | undefined\n getParentRows: () => Row<TData>[]\n}\n\nexport const createRow = <TData extends RowData>(\n table: Table<TData>,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row<TData>[],\n parentId?: string\n): Row<TData> => {\n let row: CoreRow<TData> = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () => (row.parentId ? table.getRow(row.parentId) : undefined),\n getParentRows: () => {\n let parentRows: Row<TData>[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row<TData>, column, column.id)\n })\n },\n {\n key: process.env.NODE_ENV === 'development' && 'row.getAllCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce((acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n }, {} as Record<string, Cell<TData, unknown>>)\n },\n {\n key:\n process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n Object.assign(row, feature?.createRow?.(row, table))\n }\n\n return row as Row<TData>\n}\n"],"names":["createRow","table","id","original","rowIndex","depth","subRows","parentId","row","index","_valuesCache","_uniqueValuesCache","getValue","columnId","hasOwnProperty","column","getColumn","accessorFn","undefined","getUniqueValues","columnDef","renderValue","_row$getValue","options","renderFallbackValue","getLeafRows","flattenBy","d","getParentRow","getRow","getParentRows","parentRows","currentRow","parentRow","push","reverse","getAllCells","memo","getAllLeafColumns","leafColumns","map","createCell","key","process","env","NODE_ENV","debug","_table$options$debugA","debugAll","debugRows","_getAllCellsByColumnId","allCells","reduce","acc","cell","_table$options$debugA2","i","_features","length","feature","Object","assign"],"mappings":";;;;;;;;;;;;;;;;;MAwBaA,SAAS,GAAGA,CACvBC,KAAmB,EACnBC,EAAU,EACVC,QAAe,EACfC,QAAgB,EAChBC,KAAa,EACbC,OAAsB,EACtBC,QAAiB,KACF;AACf,EAAA,IAAIC,GAAmB,GAAG;IACxBN,EAAE;AACFO,IAAAA,KAAK,EAAEL,QAAQ;IACfD,QAAQ;IACRE,KAAK;IACLE,QAAQ;IACRG,YAAY,EAAE,EAAE;IAChBC,kBAAkB,EAAE,EAAE;IACtBC,QAAQ,EAAEC,QAAQ,IAAI;MACpB,IAAIL,GAAG,CAACE,YAAY,CAACI,cAAc,CAACD,QAAQ,CAAC,EAAE;AAC7C,QAAA,OAAOL,GAAG,CAACE,YAAY,CAACG,QAAQ,CAAC,CAAA;AACnC,OAAA;AAEA,MAAA,MAAME,MAAM,GAAGd,KAAK,CAACe,SAAS,CAACH,QAAQ,CAAC,CAAA;AAExC,MAAA,IAAI,EAACE,MAAM,IAAA,IAAA,IAANA,MAAM,CAAEE,UAAU,CAAE,EAAA;AACvB,QAAA,OAAOC,SAAS,CAAA;AAClB,OAAA;AAEAV,MAAAA,GAAG,CAACE,YAAY,CAACG,QAAQ,CAAC,GAAGE,MAAM,CAACE,UAAU,CAC5CT,GAAG,CAACL,QAAQ,EACZC,QAAQ,CACT,CAAA;AAED,MAAA,OAAOI,GAAG,CAACE,YAAY,CAACG,QAAQ,CAAC,CAAA;KAClC;IACDM,eAAe,EAAEN,QAAQ,IAAI;MAC3B,IAAIL,GAAG,CAACG,kBAAkB,CAACG,cAAc,CAACD,QAAQ,CAAC,EAAE;AACnD,QAAA,OAAOL,GAAG,CAACG,kBAAkB,CAACE,QAAQ,CAAC,CAAA;AACzC,OAAA;AAEA,MAAA,MAAME,MAAM,GAAGd,KAAK,CAACe,SAAS,CAACH,QAAQ,CAAC,CAAA;AAExC,MAAA,IAAI,EA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ChD,KAAC,EACD;MACEX,GAAG,EACDC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,2BAA2B;AACtEC,MAAAA,KAAK,EAAEA,MAAA;AAAA,QAAA,IAAAS,sBAAA,CAAA;AAAA,QAAA,OAAA,CAAAA,sBAAA,GAAMtD,KAAK,CAACsB,OAAO,CAACyB,QAAQ,KAAAO,IAAAA,GAAAA,sBAAA,GAAItD,KAAK,CAACsB,OAAO,CAAC0B,SAAS,CAAA;AAAA,OAAA;KAC/D,CAAA;GAEJ,CAAA;AAED,EAAA,KAAK,IAAIO,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGvD,KAAK,CAACwD,SAAS,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;AAC/C,IAAA,MAAMG,OAAO,GAAG1D,KAAK,CAACwD,SAAS,CAACD,CAAC,CAAC,CAAA;AAClCI,IAAAA,MAAM,CAACC,MAAM,CAACrD,GAAG,EAAEmD,OAAO,oBAAPA,OAAO,CAAE3D,SAAS,IAAlB2D,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAAE3D,SAAS,CAAGQ,GAAG,EAAEP,KAAK,CAAC,CAAC,CAAA;AACtD,GAAA;AAEA,EAAA,OAAOO,GAAG,CAAA;AACZ;;;;"}
@@ -2819,13 +2819,13 @@ function createCell(table, row, column, columnId) {
2819
2819
  return cell;
2820
2820
  }
2821
2821
 
2822
- const createRow = (table, id, original, rowIndex, depth, subRows, parentRow) => {
2822
+ const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
2823
2823
  let row = {
2824
2824
  id,
2825
2825
  index: rowIndex,
2826
2826
  original,
2827
2827
  depth,
2828
- parentRow,
2828
+ parentId,
2829
2829
  _valuesCache: {},
2830
2830
  _uniqueValuesCache: {},
2831
2831
  getValue: columnId => {
@@ -2860,6 +2860,18 @@ const createRow = (table, id, original, rowIndex, depth, subRows, parentRow) =>
2860
2860
  },
2861
2861
  subRows: subRows != null ? subRows : [],
2862
2862
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
2863
+ getParentRow: () => row.parentId ? table.getRow(row.parentId) : undefined,
2864
+ getParentRows: () => {
2865
+ let parentRows = [];
2866
+ let currentRow = row;
2867
+ while (true) {
2868
+ const parentRow = currentRow.getParentRow();
2869
+ if (!parentRow) break;
2870
+ parentRows.push(parentRow);
2871
+ currentRow = parentRow;
2872
+ }
2873
+ return parentRows.reverse();
2874
+ },
2863
2875
  getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
2864
2876
  return leafColumns.map(column => {
2865
2877
  return createCell(table, row, column, column.id);
@@ -2969,7 +2981,7 @@ function getCoreRowModel() {
2969
2981
  // }
2970
2982
 
2971
2983
  // Make the row
2972
- const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow);
2984
+ const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id);
2973
2985
 
2974
2986
  // Keep track of every row in a flat array
2975
2987
  rowModel.flatRows.push(row);
@@ -3016,7 +3028,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3016
3028
  const newFilteredFlatRows = [];
3017
3029
  const newFilteredRowsById = {};
3018
3030
  const maxDepth = (_table$options$maxLea = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea : 100;
3019
- const recurseFilterRows = function (rowsToFilter, depth, parentRow) {
3031
+ const recurseFilterRows = function (rowsToFilter, depth) {
3020
3032
  if (depth === void 0) {
3021
3033
  depth = 0;
3022
3034
  }
@@ -3026,10 +3038,10 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
3026
3038
  for (let i = 0; i < rowsToFilter.length; i++) {
3027
3039
  var _row$subRows;
3028
3040
  let row = rowsToFilter[i];
3029
- const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, parentRow);
3041
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId);
3030
3042
  newRow.columnFilters = row.columnFilters;
3031
3043
  if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
3032
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1, newRow);
3044
+ newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3033
3045
  row = newRow;
3034
3046
  if (filterRow(row) && !newRow.subRows.length) {
3035
3047
  rows.push(row);
@@ -3067,7 +3079,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3067
3079
  const maxDepth = (_table$options$maxLea2 = table.options.maxLeafRowFilterDepth) != null ? _table$options$maxLea2 : 100;
3068
3080
 
3069
3081
  // Filters top level and nested rows
3070
- const recurseFilterRows = function (rowsToFilter, depth, parentRow) {
3082
+ const recurseFilterRows = function (rowsToFilter, depth) {
3071
3083
  if (depth === void 0) {
3072
3084
  depth = 0;
3073
3085
  }
@@ -3082,8 +3094,8 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
3082
3094
  if (pass) {
3083
3095
  var _row$subRows2;
3084
3096
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
3085
- const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, parentRow);
3086
- newRow.subRows = recurseFilterRows(row.subRows, depth + 1, newRow);
3097
+ const newRow = createRow(table, row.id, row.original, row.index, row.depth, undefined, row.parentId);
3098
+ newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3087
3099
  row = newRow;
3088
3100
  }
3089
3101
  rows.push(row);
@@ -3394,7 +3406,7 @@ function getGroupedRowModel() {
3394
3406
  // const nonGroupedRowsById: Record<RowId, Row> = {};
3395
3407
 
3396
3408
  // Recursively group the data
3397
- const groupUpRecursively = function (rows, depth, parentRow, parentId) {
3409
+ const groupUpRecursively = function (rows, depth, parentId) {
3398
3410
  if (depth === void 0) {
3399
3411
  depth = 0;
3400
3412
  }
@@ -3406,7 +3418,7 @@ function getGroupedRowModel() {
3406
3418
  groupedFlatRows.push(row);
3407
3419
  groupedRowsById[row.id] = row;
3408
3420
  if (row.subRows) {
3409
- row.subRows = groupUpRecursively(row.subRows, depth + 1, row);
3421
+ row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id);
3410
3422
  }
3411
3423
  return row;
3412
3424
  });
@@ -3423,11 +3435,11 @@ function getGroupedRowModel() {
3423
3435
  id = parentId ? `${parentId}>${id}` : id;
3424
3436
 
3425
3437
  // First, Recurse to group sub rows before aggregation
3426
- const subRows = groupUpRecursively(groupedRows, depth + 1, parentRow, id);
3438
+ const subRows = groupUpRecursively(groupedRows, depth + 1, id);
3427
3439
 
3428
3440
  // Flatten the leaf rows of the rows in this group
3429
3441
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3430
- const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentRow);
3442
+ const row = createRow(table, id, leafRows[0].original, index, depth, undefined, parentId);
3431
3443
  Object.assign(row, {
3432
3444
  groupingColumnId: columnId,
3433
3445
  groupingValue,
@@ -3474,7 +3486,7 @@ function getGroupedRowModel() {
3474
3486
  });
3475
3487
  return aggregatedGroupedRows;
3476
3488
  };
3477
- const groupedRows = groupUpRecursively(rowModel.rows, 0, undefined, '');
3489
+ const groupedRows = groupUpRecursively(rowModel.rows, 0);
3478
3490
  groupedRows.forEach(subRow => {
3479
3491
  groupedFlatRows.push(subRow);
3480
3492
  groupedRowsById[subRow.id] = subRow;