@tanstack/table-core 8.5.11 → 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;;;;"}
@@ -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