From a0e1cfc0683ed768a5d84e31562aeebf2e30acef Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:37:29 +0100 Subject: [PATCH 1/3] perf: pre-compute instance init functions When we construct a row, we iterate over the table's features and initialise any which have an `initRowInstanceData`. This is expensive since most don't have such a method. We actually know when we construct the table which features have this method. This changes the table construction to store the initialisers up front so when we create a row, we can just iterate the already known initialisers. --- packages/table-core/src/core/rows/constructRow.ts | 6 +++--- packages/table-core/src/core/table/constructTable.ts | 10 ++++++++++ .../src/core/table/coreTablesFeature.types.ts | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/table-core/src/core/rows/constructRow.ts b/packages/table-core/src/core/rows/constructRow.ts index 663f346962..a950f00505 100644 --- a/packages/table-core/src/core/rows/constructRow.ts +++ b/packages/table-core/src/core/rows/constructRow.ts @@ -59,9 +59,9 @@ export const constructRow = < row.subRows = subRows ?? [] // Initialize instance-specific data (e.g., caches) for features that need it - const features = Object.values(table._features) - for (let i = 0; i < features.length; i++) { - features[i]!.initRowInstanceData?.(row) + const initFns = table._rowInstanceInitFns! + for (let i = 0; i < initFns.length; i++) { + initFns[i]!(row as Row) } return row as Row diff --git a/packages/table-core/src/core/table/constructTable.ts b/packages/table-core/src/core/table/constructTable.ts index 3a2f648966..520a33303a 100644 --- a/packages/table-core/src/core/table/constructTable.ts +++ b/packages/table-core/src/core/table/constructTable.ts @@ -68,6 +68,16 @@ export function constructTable< const featuresList: Array = Object.values(table._features) + const rowInstanceInitFns: Array< + NonNullable + > = [] + for (const feature of featuresList) { + if (feature.initRowInstanceData) { + rowInstanceInitFns.push(feature.initRowInstanceData) + } + } + table._rowInstanceInitFns = rowInstanceInitFns + const defaultOptions = featuresList.reduce((obj, feature) => { return Object.assign(obj, feature.getDefaultTableOptions?.(table)) }, {}) as TableOptions diff --git a/packages/table-core/src/core/table/coreTablesFeature.types.ts b/packages/table-core/src/core/table/coreTablesFeature.types.ts index 8570660430..80afe099e7 100644 --- a/packages/table-core/src/core/table/coreTablesFeature.types.ts +++ b/packages/table-core/src/core/table/coreTablesFeature.types.ts @@ -5,6 +5,7 @@ import type { RowModelFns } from '../../types/RowModelFns' import type { RowData, Updater } from '../../types/type-utils' import type { IsAny, + TableFeature, TableFeatures, ValidateFeatureSlots, } from '../../types/TableFeatures' @@ -188,6 +189,10 @@ export interface Table_CoreProperties< * Prototype cache for Row objects - shared by all rows in this table */ _rowPrototype?: object + /** + * Cache of the `initRowInstanceData` functions for features that define one. + */ + _rowInstanceInitFns?: Array> /** * The readonly derived atoms for each `TableState` slice. Each derives from * its corresponding `baseAtom` plus, optionally, a per-slice external atom or From a0057d30a2c1f0a07c4a7bafe160c07276cc9c30 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:10:40 +0100 Subject: [PATCH 2/3] fix(table-core): bind initialiser to feature Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- packages/table-core/src/core/table/constructTable.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/table-core/src/core/table/constructTable.ts b/packages/table-core/src/core/table/constructTable.ts index 520a33303a..2d706c8234 100644 --- a/packages/table-core/src/core/table/constructTable.ts +++ b/packages/table-core/src/core/table/constructTable.ts @@ -73,7 +73,7 @@ export function constructTable< > = [] for (const feature of featuresList) { if (feature.initRowInstanceData) { - rowInstanceInitFns.push(feature.initRowInstanceData) + rowInstanceInitFns.push(feature.initRowInstanceData.bind(feature)) } } table._rowInstanceInitFns = rowInstanceInitFns From 7f6d788c5aa56dfd94c56c4b203b99fedd292492 Mon Sep 17 00:00:00 2001 From: Kevin Van Cott Date: Fri, 24 Jul 2026 10:57:30 -0500 Subject: [PATCH 3/3] cache init functions consistently for all table objects --- .../framework/alpine/guide/custom-features.md | 50 +++- .../angular/guide/custom-features.md | 50 +++- docs/framework/ember/guide/custom-features.md | 50 +++- docs/framework/lit/guide/custom-features.md | 50 +++- .../framework/preact/guide/custom-features.md | 50 +++- docs/framework/react/guide/custom-features.md | 50 +++- docs/framework/solid/guide/custom-features.md | 50 +++- .../framework/svelte/guide/custom-features.md | 50 +++- docs/framework/vue/guide/custom-features.md | 50 +++- .../index/functions/constructColumn.md | 2 +- .../index/functions/makeStateUpdater.md | 2 +- .../index/interfaces/ColumnDef_RowSorting.md | 2 +- .../index/interfaces/FeatureSlotPrereqs.md | 30 +-- docs/reference/index/interfaces/Plugins.md | 2 +- .../index/interfaces/Row_Aggregation.md | 6 +- .../index/interfaces/TableFeature.md | 154 ++++++++++-- .../index/interfaces/TableFeatures.md | 32 +-- docs/reference/index/interfaces/TableMeta.md | 2 +- .../index/interfaces/TableOptions_Core.md | 18 +- .../index/interfaces/TableOptions_Table.md | 20 +- docs/reference/index/interfaces/Table_Core.md | 224 +++++++++++++++-- .../index/interfaces/Table_CoreProperties.md | 202 ++++++++++++++-- .../index/interfaces/Table_Internal.md | 220 ++++++++++++++++- .../reference/index/interfaces/Table_Table.md | 226 ++++++++++++++++-- docs/reference/index/type-aliases/Atoms.md | 2 +- .../reference/index/type-aliases/Atoms_All.md | 2 +- .../reference/index/type-aliases/BaseAtoms.md | 2 +- .../index/type-aliases/BaseAtoms_All.md | 2 +- .../type-aliases/BuiltInAggregationFn.md | 2 +- .../index/type-aliases/ColumnDefResolved.md | 2 +- .../reference/index/type-aliases/DeepValue.md | 2 +- .../index/type-aliases/ExternalAtoms.md | 2 +- .../index/type-aliases/ExternalAtoms_All.md | 2 +- .../type-aliases/ExtractFeatureMapTypes.md | 2 +- .../index/type-aliases/ExtractTableMeta.md | 2 +- docs/reference/index/type-aliases/IsAny.md | 2 +- .../index/type-aliases/NonFeatureKeys.md | 2 +- .../type-aliases/ValidateFeatureSlots.md | 2 +- .../index/variables/aggregationFn_count.md | 2 +- .../index/variables/aggregationFn_extent.md | 2 +- .../index/variables/aggregationFn_first.md | 2 +- .../index/variables/aggregationFn_last.md | 2 +- .../index/variables/aggregationFn_max.md | 2 +- .../index/variables/aggregationFn_mean.md | 2 +- .../index/variables/aggregationFn_median.md | 2 +- .../index/variables/aggregationFn_min.md | 2 +- .../index/variables/aggregationFn_sum.md | 2 +- .../index/variables/aggregationFn_unique.md | 2 +- .../variables/aggregationFn_uniqueCount.md | 2 +- .../index/variables/aggregationFns.md | 2 +- .../functions/aggregateColumnValue.md | 10 +- .../functions/cell_getIsAggregated.md | 2 +- .../functions/column_getAggregationFns.md | 2 +- .../functions/column_getAggregationValue.md | 2 +- .../functions/column_getAutoAggregationFn.md | 2 +- .../functions/formatAggregatedCellValue.md | 2 +- .../functions/isRowSelected.md | 2 +- .../functions/isSubRowSelected.md | 2 +- .../normalizeUniqueAggregationRows.md | 42 ++++ .../functions/row_getCanMultiSelect.md | 2 +- .../functions/row_getCanSelect.md | 2 +- .../functions/row_getCanSelectSubRows.md | 2 +- .../functions/row_getIsAllSubRowsSelected.md | 2 +- .../functions/row_getIsSelected.md | 2 +- .../functions/row_getIsSomeSelected.md | 2 +- .../functions/row_getToggleSelectedHandler.md | 2 +- .../functions/row_toggleSelected.md | 5 +- .../functions/selectRowsFn.md | 2 +- docs/reference/static-functions/index.md | 1 + .../src/core/cells/constructCell.ts | 6 + .../src/core/columns/constructColumn.ts | 7 +- .../src/core/headers/buildHeaderGroups.ts | 7 + .../src/core/headers/constructHeader.ts | 6 + .../src/core/table/constructTable.ts | 53 +++- .../src/core/table/coreTablesFeature.types.ts | 24 ++ .../table-core/src/types/TableFeatures.ts | 56 ++++- .../unit/core/cells/constructCell.test.ts | 44 ++++ .../unit/core/headers/constructHeader.test.ts | 116 +++++++++ .../unit/core/table/constructTable.test.ts | 53 ++++ 79 files changed, 1859 insertions(+), 245 deletions(-) create mode 100644 docs/reference/static-functions/functions/normalizeUniqueAggregationRows.md diff --git a/docs/framework/alpine/guide/custom-features.md b/docs/framework/alpine/guide/custom-features.md index b1a3dbbccf..5d0ad25fcd 100644 --- a/docs/framework/alpine/guide/custom-features.md +++ b/docs/framework/alpine/guide/custom-features.md @@ -70,6 +70,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -127,15 +154,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-#### assignHeaderPrototype +#### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +#### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-#### assignColumnPrototype +#### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -145,9 +178,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-#### assignCellPrototype +#### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ## Adding a Custom Feature @@ -279,10 +312,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/angular/guide/custom-features.md b/docs/framework/angular/guide/custom-features.md index 19dd97dc60..50d1fe2e27 100644 --- a/docs/framework/angular/guide/custom-features.md +++ b/docs/framework/angular/guide/custom-features.md @@ -76,6 +76,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -133,15 +160,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-##### assignHeaderPrototype +##### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +##### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-##### assignColumnPrototype +##### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -151,9 +184,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-##### assignCellPrototype +##### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ### Adding a Custom Feature @@ -274,10 +307,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/ember/guide/custom-features.md b/docs/framework/ember/guide/custom-features.md index 1f58c552b9..e303d4b6dc 100644 --- a/docs/framework/ember/guide/custom-features.md +++ b/docs/framework/ember/guide/custom-features.md @@ -76,6 +76,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -133,15 +160,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-##### assignHeaderPrototype +##### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +##### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-##### assignColumnPrototype +##### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -151,9 +184,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-##### assignCellPrototype +##### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ### Adding a Custom Feature @@ -286,10 +319,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/lit/guide/custom-features.md b/docs/framework/lit/guide/custom-features.md index a0367cb68c..230212a129 100644 --- a/docs/framework/lit/guide/custom-features.md +++ b/docs/framework/lit/guide/custom-features.md @@ -68,6 +68,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -125,15 +152,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-#### assignHeaderPrototype +#### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +#### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-#### assignColumnPrototype +#### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -143,9 +176,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-#### assignCellPrototype +#### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ## Adding a Custom Feature @@ -266,10 +299,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/preact/guide/custom-features.md b/docs/framework/preact/guide/custom-features.md index 6219f20e7e..bce4072fb1 100644 --- a/docs/framework/preact/guide/custom-features.md +++ b/docs/framework/preact/guide/custom-features.md @@ -76,6 +76,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -133,15 +160,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-##### assignHeaderPrototype +##### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +##### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-##### assignColumnPrototype +##### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -151,9 +184,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-##### assignCellPrototype +##### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ### Adding a Custom Feature @@ -274,10 +307,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/react/guide/custom-features.md b/docs/framework/react/guide/custom-features.md index 9884a75fa6..42aad2fb41 100644 --- a/docs/framework/react/guide/custom-features.md +++ b/docs/framework/react/guide/custom-features.md @@ -76,6 +76,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -133,15 +160,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-##### assignHeaderPrototype +##### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +##### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-##### assignColumnPrototype +##### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -151,9 +184,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-##### assignCellPrototype +##### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ### Adding a Custom Feature @@ -274,10 +307,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/solid/guide/custom-features.md b/docs/framework/solid/guide/custom-features.md index 4e8e4093fe..6faf75b019 100644 --- a/docs/framework/solid/guide/custom-features.md +++ b/docs/framework/solid/guide/custom-features.md @@ -70,6 +70,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -127,15 +154,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-#### assignHeaderPrototype +#### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +#### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-#### assignColumnPrototype +#### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -145,9 +178,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-#### assignCellPrototype +#### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ## Adding a Custom Feature @@ -268,10 +301,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/svelte/guide/custom-features.md b/docs/framework/svelte/guide/custom-features.md index 48bee39a91..81edc25879 100644 --- a/docs/framework/svelte/guide/custom-features.md +++ b/docs/framework/svelte/guide/custom-features.md @@ -70,6 +70,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -127,15 +154,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-#### assignHeaderPrototype +#### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +#### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-#### assignColumnPrototype +#### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -145,9 +178,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-#### assignCellPrototype +#### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ## Adding a Custom Feature @@ -268,10 +301,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/framework/vue/guide/custom-features.md b/docs/framework/vue/guide/custom-features.md index c908c5d87d..862de8122d 100644 --- a/docs/framework/vue/guide/custom-features.md +++ b/docs/framework/vue/guide/custom-features.md @@ -70,6 +70,33 @@ export interface TableFeature { table: Table_Internal, ) => Partial> getInitialState?: (initialState: Partial) => TableState_All + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void + initColumnInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + column: Column, + ) => void + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void initRowInstanceData?: < TFeatures extends TableFeatures, TData extends RowData, @@ -127,15 +154,21 @@ The `constructTableAPIs` method in a table feature is exclusively responsible fo
-#### assignHeaderPrototype +#### assignHeaderPrototype and initHeaderInstanceData + +The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. The `initHeaderInstanceData` method is available for per-header instance data or caches that cannot live on the shared prototype. It runs during header construction, before sub-headers are populated and before the header is linked to its header group. Headers are reconstructed whenever header groups recompute, so it reruns on every rebuild. + +
+ +#### initHeaderGroupInstanceData -The `assignHeaderPrototype` method in a table feature is responsible for adding methods to the shared `header` prototype. For example, the [Column Sizing](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/column-sizing/columnSizingFeature.ts) feature adds header instance API methods such as `getStart`. So then, when you call `header.getStart()`, you are calling a method that was added by the column sizing feature. +The `initHeaderGroupInstanceData` method is available for per-header-group instance data. Header groups have no shared prototype, so this is their only per-instance extension point. It runs after a header group's `depth`, `id`, and fully populated `headers` array have been assigned, and reruns whenever header groups are rebuilt.
-#### assignColumnPrototype +#### assignColumnPrototype and initColumnInstanceData -The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. +The `assignColumnPrototype` method in a table feature is responsible for adding methods to the shared `column` prototype. For example, the [Sorting](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-sorting/rowSortingFeature.ts) feature adds column instance API methods such as `getNextSortingOrder`, `toggleSorting`, etc. So then, when you call `column.toggleSorting()`, you are calling a method that was added by the row sorting feature. The `initColumnInstanceData` method is available for per-column instance data or caches that cannot live on the shared prototype. For example, the [Aggregation](https://github.com/TanStack/table/blob/beta/packages/table-core/src/features/row-aggregation/rowAggregationFeature.ts) feature uses it to set up a per-column aggregation cache.
@@ -145,9 +178,9 @@ The `assignRowPrototype` method in a table feature is responsible for adding met
-#### assignCellPrototype +#### assignCellPrototype and initCellInstanceData -The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. +The `assignCellPrototype` method in a table feature is responsible for adding methods to the shared `cell` prototype. For example, Column Grouping adds `getIsGrouped` and `getIsPlaceholder`, while Aggregation adds `getIsAggregated`. The `initCellInstanceData` method is available for per-cell instance data or caches that cannot live on the shared prototype. Cells are constructed lazily on first access per row/column pair and cached, so it runs once per cell instance. ## Adding a Custom Feature @@ -268,10 +301,15 @@ export const densityPlugin: TableFeature = { // initRowInstanceData: (row) => {}, // if you need to add cell instance APIs... // assignCellPrototype: (prototype, table) => {}, + // initCellInstanceData: (cell) => {}, // if you need to add column instance APIs... // assignColumnPrototype: (prototype, table) => {}, + // initColumnInstanceData: (column) => {}, // if you need to add header instance APIs... // assignHeaderPrototype: (prototype, table) => {}, + // initHeaderInstanceData: (header) => {}, + // if you need to add header group instance data... + // initHeaderGroupInstanceData: (headerGroup) => {}, } ``` diff --git a/docs/reference/index/functions/constructColumn.md b/docs/reference/index/functions/constructColumn.md index 924d5bb7a0..8d5dccb313 100644 --- a/docs/reference/index/functions/constructColumn.md +++ b/docs/reference/index/functions/constructColumn.md @@ -13,7 +13,7 @@ function constructColumn( parent?): Column; ``` -Defined in: [core/columns/constructColumn.ts:36](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/columns/constructColumn.ts#L36) +Defined in: [core/columns/constructColumn.ts:35](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/columns/constructColumn.ts#L35) Constructs a column instance from normalized table internals. diff --git a/docs/reference/index/functions/makeStateUpdater.md b/docs/reference/index/functions/makeStateUpdater.md index f7f327f865..436b09ba16 100644 --- a/docs/reference/index/functions/makeStateUpdater.md +++ b/docs/reference/index/functions/makeStateUpdater.md @@ -57,7 +57,7 @@ The updater writes through the table base atom for the slice and supports both v #### updater -[`Updater`](../type-aliases/Updater.md)\<`TableState_WorkerRowModels` & [`TableState_ColumnGrouping`](../interfaces/TableState_ColumnGrouping.md) & [`TableState_ColumnPinning`](../interfaces/TableState_ColumnPinning.md) & [`TableState_ColumnSizing`](../interfaces/TableState_ColumnSizing.md) & [`TableState_ColumnResizing`](../interfaces/TableState_ColumnResizing.md) & [`TableState_GlobalFiltering`](../interfaces/TableState_GlobalFiltering.md) & [`TableState_ColumnVisibility`](../interfaces/TableState_ColumnVisibility.md) & [`TableState_RowExpanding`](../interfaces/TableState_RowExpanding.md) & [`TableState_RowPinning`](../interfaces/TableState_RowPinning.md) & [`TableState_RowSelection`](../interfaces/TableState_RowSelection.md) & [`TableState_ColumnFiltering`](../interfaces/TableState_ColumnFiltering.md) & [`TableState_RowPagination`](../interfaces/TableState_RowPagination.md) & [`TableState_RowSorting`](../interfaces/TableState_RowSorting.md) & [`TableState_ColumnOrdering`](../interfaces/TableState_ColumnOrdering.md)\[`K` & +[`Updater`](../type-aliases/Updater.md)\<`TableState_WorkerRowModels` & [`TableState_RowSorting`](../interfaces/TableState_RowSorting.md) & [`TableState_ColumnPinning`](../interfaces/TableState_ColumnPinning.md) & [`TableState_ColumnSizing`](../interfaces/TableState_ColumnSizing.md) & [`TableState_ColumnResizing`](../interfaces/TableState_ColumnResizing.md) & [`TableState_GlobalFiltering`](../interfaces/TableState_GlobalFiltering.md) & [`TableState_ColumnOrdering`](../interfaces/TableState_ColumnOrdering.md) & [`TableState_ColumnVisibility`](../interfaces/TableState_ColumnVisibility.md) & [`TableState_RowExpanding`](../interfaces/TableState_RowExpanding.md) & [`TableState_RowPinning`](../interfaces/TableState_RowPinning.md) & [`TableState_RowSelection`](../interfaces/TableState_RowSelection.md) & [`TableState_ColumnFiltering`](../interfaces/TableState_ColumnFiltering.md) & [`TableState_RowPagination`](../interfaces/TableState_RowPagination.md) & [`TableState_ColumnGrouping`](../interfaces/TableState_ColumnGrouping.md)\[`K` & \| `"expanded"` \| `"columnFilters"` \| `"globalFilter"` diff --git a/docs/reference/index/interfaces/ColumnDef_RowSorting.md b/docs/reference/index/interfaces/ColumnDef_RowSorting.md index b3161929cd..3b1ad97805 100644 --- a/docs/reference/index/interfaces/ColumnDef_RowSorting.md +++ b/docs/reference/index/interfaces/ColumnDef_RowSorting.md @@ -84,7 +84,7 @@ The sorting function to use with this column. ### sortUndefined? ```ts -optional sortUndefined: false | 1 | "first" | "last" | -1; +optional sortUndefined: false | 1 | -1 | "first" | "last"; ``` Defined in: [features/row-sorting/rowSortingFeature.types.ts:153](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-sorting/rowSortingFeature.types.ts#L153) diff --git a/docs/reference/index/interfaces/FeatureSlotPrereqs.md b/docs/reference/index/interfaces/FeatureSlotPrereqs.md index 3c596f6235..d78f968f7d 100644 --- a/docs/reference/index/interfaces/FeatureSlotPrereqs.md +++ b/docs/reference/index/interfaces/FeatureSlotPrereqs.md @@ -5,7 +5,7 @@ title: FeatureSlotPrereqs # Interface: FeatureSlotPrereqs -Defined in: [types/TableFeatures.ts:91](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L91) +Defined in: [types/TableFeatures.ts:94](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L94) Maps each row model and fn registry slot to the feature(s) that must be registered alongside it in the same features object. @@ -21,7 +21,7 @@ interface to get the same validation from `tableFeatures()`. aggregationFns: "rowAggregationFeature"; ``` -Defined in: [types/TableFeatures.ts:95](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L95) +Defined in: [types/TableFeatures.ts:98](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L98) Named aggregation functions require the independent aggregation feature. @@ -33,7 +33,7 @@ Named aggregation functions require the independent aggregation feature. columnResizingFeature: "columnSizingFeature"; ``` -Defined in: [types/TableFeatures.ts:99](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L99) +Defined in: [types/TableFeatures.ts:102](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L102) Column resizing builds on the column sizing state and APIs. @@ -45,7 +45,7 @@ Column resizing builds on the column sizing state and APIs. expandedRowModel: "rowExpandingFeature"; ``` -Defined in: [types/TableFeatures.ts:103](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L103) +Defined in: [types/TableFeatures.ts:106](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L106) Expanded row-model factories require row expanding APIs and state. @@ -57,7 +57,7 @@ Expanded row-model factories require row expanding APIs and state. facetedMinMaxValues: "columnFacetingFeature"; ``` -Defined in: [types/TableFeatures.ts:107](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L107) +Defined in: [types/TableFeatures.ts:110](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L110) Faceted min/max factories require column faceting APIs. @@ -69,7 +69,7 @@ Faceted min/max factories require column faceting APIs. facetedRowModel: "columnFacetingFeature"; ``` -Defined in: [types/TableFeatures.ts:111](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L111) +Defined in: [types/TableFeatures.ts:114](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L114) Faceted row-model factories require column faceting APIs. @@ -81,7 +81,7 @@ Faceted row-model factories require column faceting APIs. facetedUniqueValues: "columnFacetingFeature"; ``` -Defined in: [types/TableFeatures.ts:115](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L115) +Defined in: [types/TableFeatures.ts:118](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L118) Faceted unique-value factories require column faceting APIs. @@ -93,7 +93,7 @@ Faceted unique-value factories require column faceting APIs. filteredRowModel: "columnFilteringFeature"; ``` -Defined in: [types/TableFeatures.ts:119](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L119) +Defined in: [types/TableFeatures.ts:122](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L122) Filtered row-model factories require column filtering APIs and state. @@ -105,7 +105,7 @@ Filtered row-model factories require column filtering APIs and state. filterFns: "columnFilteringFeature"; ``` -Defined in: [types/TableFeatures.ts:123](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L123) +Defined in: [types/TableFeatures.ts:126](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L126) Named filter functions are only meaningful when column filtering is enabled. @@ -117,7 +117,7 @@ Named filter functions are only meaningful when column filtering is enabled. filterMeta: "columnFilteringFeature"; ``` -Defined in: [types/TableFeatures.ts:127](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L127) +Defined in: [types/TableFeatures.ts:130](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L130) Filter metadata types are only read and written by filtering features. @@ -129,7 +129,7 @@ Filter metadata types are only read and written by filtering features. globalFilteringFeature: "columnFilteringFeature"; ``` -Defined in: [types/TableFeatures.ts:131](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L131) +Defined in: [types/TableFeatures.ts:134](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L134) Global filtering builds on column filtering state and filter functions. @@ -141,7 +141,7 @@ Global filtering builds on column filtering state and filter functions. groupedRowModel: "columnGroupingFeature"; ``` -Defined in: [types/TableFeatures.ts:135](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L135) +Defined in: [types/TableFeatures.ts:138](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L138) Grouped row-model factories require column grouping APIs and state. @@ -153,7 +153,7 @@ Grouped row-model factories require column grouping APIs and state. paginatedRowModel: "rowPaginationFeature"; ``` -Defined in: [types/TableFeatures.ts:139](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L139) +Defined in: [types/TableFeatures.ts:142](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L142) Paginated row-model factories require row pagination APIs and state. @@ -165,7 +165,7 @@ Paginated row-model factories require row pagination APIs and state. sortedRowModel: "rowSortingFeature"; ``` -Defined in: [types/TableFeatures.ts:143](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L143) +Defined in: [types/TableFeatures.ts:146](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L146) Sorted row-model factories require row sorting APIs and state. @@ -177,6 +177,6 @@ Sorted row-model factories require row sorting APIs and state. sortFns: "rowSortingFeature"; ``` -Defined in: [types/TableFeatures.ts:147](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L147) +Defined in: [types/TableFeatures.ts:150](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L150) Named sorting functions are only meaningful when row sorting is enabled. diff --git a/docs/reference/index/interfaces/Plugins.md b/docs/reference/index/interfaces/Plugins.md index 2d570a56eb..e5f42aeba0 100644 --- a/docs/reference/index/interfaces/Plugins.md +++ b/docs/reference/index/interfaces/Plugins.md @@ -5,7 +5,7 @@ title: Plugins # Interface: Plugins -Defined in: [types/TableFeatures.ts:57](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L57) +Defined in: [types/TableFeatures.ts:60](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L60) Declaration-merge target for custom table features. diff --git a/docs/reference/index/interfaces/Row_Aggregation.md b/docs/reference/index/interfaces/Row_Aggregation.md index cac19b6a48..7e0eab76e9 100644 --- a/docs/reference/index/interfaces/Row_Aggregation.md +++ b/docs/reference/index/interfaces/Row_Aggregation.md @@ -11,12 +11,12 @@ Internal per-row cache used while grouped aggregates are evaluated. ## Properties -### \_aggregationValuesCache +### \_aggregationValuesCache? ```ts -_aggregationValuesCache: Record; +optional _aggregationValuesCache: Record; ``` Defined in: [features/row-aggregation/rowAggregationFeature.types.ts:306](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.types.ts#L306) -Cached aggregate results keyed by column id. +Cached aggregate results keyed by column id; created lazily on grouped rows. diff --git a/docs/reference/index/interfaces/TableFeature.md b/docs/reference/index/interfaces/TableFeature.md index 637022ab06..b848353d04 100644 --- a/docs/reference/index/interfaces/TableFeature.md +++ b/docs/reference/index/interfaces/TableFeature.md @@ -5,14 +5,14 @@ title: TableFeature # Interface: TableFeature -Defined in: [types/TableFeatures.ts:316](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L316) +Defined in: [types/TableFeatures.ts:319](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L319) Lifecycle hooks and defaults contributed by a table feature. Feature objects are registered in the table's `features` option. They can contribute default state/options, default column definitions, table APIs, -shared prototype APIs for rows/columns/headers/cells, and per-instance row -or column data. +shared prototype APIs for rows/columns/headers/cells, and per-instance data +for tables, columns, rows, headers, header groups, and cells. ## Properties @@ -22,7 +22,7 @@ or column data. optional assignCellPrototype: (prototype, table) => void; ``` -Defined in: [types/TableFeatures.ts:325](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L325) +Defined in: [types/TableFeatures.ts:328](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L328) Adds feature methods to the shared cell prototype for a table. @@ -63,7 +63,7 @@ per-cell mutable data. optional assignColumnPrototype: (prototype, table) => void; ``` -Defined in: [types/TableFeatures.ts:340](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L340) +Defined in: [types/TableFeatures.ts:343](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L343) Adds feature methods to the shared column prototype for a table. @@ -104,7 +104,7 @@ than per-column mutable data. optional assignHeaderPrototype: (prototype, table) => void; ``` -Defined in: [types/TableFeatures.ts:355](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L355) +Defined in: [types/TableFeatures.ts:358](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L358) Adds feature methods to the shared header prototype for a table. @@ -145,7 +145,7 @@ than per-header mutable data. optional assignRowPrototype: (prototype, table) => void; ``` -Defined in: [types/TableFeatures.ts:370](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L370) +Defined in: [types/TableFeatures.ts:373](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L373) Adds feature methods to the shared row prototype for a table. @@ -186,7 +186,7 @@ mutable data. optional constructTableAPIs: (table) => void; ``` -Defined in: [types/TableFeatures.ts:383](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L383) +Defined in: [types/TableFeatures.ts:386](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L386) Adds feature APIs directly to the table instance. @@ -224,7 +224,7 @@ feature's `initTableInstanceData` hook has completed. optional getDefaultColumnDef: () => ColumnDefBase_All; ``` -Defined in: [types/TableFeatures.ts:393](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L393) +Defined in: [types/TableFeatures.ts:396](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L396) Returns default column definition options contributed by this feature. @@ -258,7 +258,7 @@ resolved, so users can override values supplied here. optional getDefaultTableOptions: (table) => Partial>; ``` -Defined in: [types/TableFeatures.ts:406](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L406) +Defined in: [types/TableFeatures.ts:409](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L409) Returns default table options contributed by this feature. @@ -295,7 +295,7 @@ here. optional getInitialState: (initialState) => TableState_All; ``` -Defined in: [types/TableFeatures.ts:420](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L420) +Defined in: [types/TableFeatures.ts:423](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L423) Returns this feature's initial table state. @@ -316,13 +316,55 @@ override feature defaults. *** +### initCellInstanceData()? + +```ts +optional initCellInstanceData: (cell) => void; +``` + +Defined in: [types/TableFeatures.ts:449](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L449) + +Initializes instance-specific data on each cell. + +This runs for every constructed cell after core cell fields such as `id`, +`column`, and `row` have been assigned. Cells are constructed lazily on +first access per row/column pair and cached, so this runs once per cell +instance. Use this for per-cell mutable data, caches, or annotations. +Shared methods should be assigned via `assignCellPrototype` instead. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### cell + +[`Cell`](../type-aliases/Cell.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +*** + ### initColumnInstanceData()? ```ts optional initColumnInstanceData: (column) => void; ``` -Defined in: [types/TableFeatures.ts:445](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L445) +Defined in: [types/TableFeatures.ts:464](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L464) Initializes instance-specific data on each column. @@ -357,13 +399,95 @@ methods should be assigned via `assignColumnPrototype` instead. *** +### initHeaderGroupInstanceData()? + +```ts +optional initHeaderGroupInstanceData: (headerGroup) => void; +``` + +Defined in: [types/TableFeatures.ts:480](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L480) + +Initializes instance-specific data on each header group. + +This runs for every constructed header group after `depth`, `id`, and the +fully populated `headers` array have been assigned. Header groups have no +shared prototype, so this is their only per-instance extension point. +Header groups are reconstructed whenever they recompute (e.g. column +visibility, order, or pinning changes), so this reruns on every rebuild. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### headerGroup + +[`HeaderGroup`](HeaderGroup.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +*** + +### initHeaderInstanceData()? + +```ts +optional initHeaderInstanceData: (header) => void; +``` + +Defined in: [types/TableFeatures.ts:497](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L497) + +Initializes instance-specific data on each header. + +This runs for every constructed header after core header fields such as +`id`, `column`, `depth`, `index`, and `isPlaceholder` have been assigned, +but before `subHeaders` are populated and before `headerGroup` is linked. +Headers are reconstructed on every header group rebuild, so this reruns +on every rebuild. Use this for per-header mutable data, caches, or +annotations. Shared methods should be assigned via `assignHeaderPrototype` +instead. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### header + +[`Header`](../type-aliases/Header.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +*** + ### initRowInstanceData()? ```ts optional initRowInstanceData: (row) => void; ``` -Defined in: [types/TableFeatures.ts:460](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L460) +Defined in: [types/TableFeatures.ts:512](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L512) Initializes instance-specific data on each row. @@ -400,7 +524,7 @@ should be assigned via `assignRowPrototype` instead. optional initTableInstanceData: (table) => void; ``` -Defined in: [types/TableFeatures.ts:431](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L431) +Defined in: [types/TableFeatures.ts:434](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L434) Initializes mutable, non-reactive data owned by this feature on the table instance. @@ -439,7 +563,7 @@ methods. Table resets do not rerun this hook; use optional resetTableInstanceData: (table) => void; ``` -Defined in: [types/TableFeatures.ts:473](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L473) +Defined in: [types/TableFeatures.ts:525](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L525) Resets mutable, non-reactive table-instance data owned by this feature. diff --git a/docs/reference/index/interfaces/TableFeatures.md b/docs/reference/index/interfaces/TableFeatures.md index 8f41baca2c..b29bf14067 100644 --- a/docs/reference/index/interfaces/TableFeatures.md +++ b/docs/reference/index/interfaces/TableFeatures.md @@ -5,7 +5,7 @@ title: TableFeatures # Interface: TableFeatures -Defined in: [types/TableFeatures.ts:181](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L181) +Defined in: [types/TableFeatures.ts:184](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L184) Complete feature registry for a table. @@ -27,7 +27,7 @@ options, and state types. optional aggregationFns: Record>; ``` -Defined in: [types/TableFeatures.ts:193](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L193) +Defined in: [types/TableFeatures.ts:196](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L196) Registry of aggregation functions available to this table by name. @@ -88,7 +88,7 @@ Defined in: [features/stockFeatures.ts:21](https://github.com/TanStack/table/blo optional columnMeta: object; ``` -Defined in: [types/TableFeatures.ts:204](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L204) +Defined in: [types/TableFeatures.ts:207](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L207) Type-only slot for declaring the type of `columnDef.meta` for all columns of this table. @@ -233,7 +233,7 @@ Defined in: [core/coreFeatures.ts:10](https://github.com/TanStack/table/blob/mai optional coreRowModel: (table) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:209](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L209) +Defined in: [types/TableFeatures.ts:212](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L212) Factory for the table's core (unmodified) row model. Defaults to the built-in `createCoreRowModel()` when omitted. @@ -304,7 +304,7 @@ Defined in: [core/coreFeatures.ts:16](https://github.com/TanStack/table/blob/mai optional expandedRowModel: (table) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L215) +Defined in: [types/TableFeatures.ts:218](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L218) Factory for the client-side expanded row model. Pass the exported `createExpandedRowModel()` or implement your own. Not needed for @@ -334,7 +334,7 @@ server-side expansion. optional facetedMinMaxValues: (table, columnId) => () => [number, number] | undefined; ``` -Defined in: [types/TableFeatures.ts:221](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L221) +Defined in: [types/TableFeatures.ts:224](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L224) Factory for per-column faceted min/max values. Pass the exported `createFacetedMinMaxValues()` or implement your own. Not needed for @@ -368,7 +368,7 @@ server-side faceting. optional facetedRowModel: (table, columnId) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:230](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L230) +Defined in: [types/TableFeatures.ts:233](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L233) Factory for the per-column faceted row model. Pass the exported `createFacetedRowModel()` or implement your own. Not needed for @@ -402,7 +402,7 @@ server-side faceting. optional facetedUniqueValues: (table, columnId) => () => Map; ``` -Defined in: [types/TableFeatures.ts:236](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L236) +Defined in: [types/TableFeatures.ts:239](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L239) Factory for per-column faceted unique values. Pass the exported `createFacetedUniqueValues()` or implement your own. Not needed for @@ -436,7 +436,7 @@ server-side faceting. optional filteredRowModel: (table) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:242](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L242) +Defined in: [types/TableFeatures.ts:245](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L245) Factory for the client-side filtered row model. Pass the exported `createFilteredRowModel()` or implement your own. Not needed for @@ -466,7 +466,7 @@ server-side filtering. optional filterFns: Record>; ``` -Defined in: [types/TableFeatures.ts:254](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L254) +Defined in: [types/TableFeatures.ts:257](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L257) Registry of filter functions available to this table by name. @@ -486,7 +486,7 @@ built-in filter function in your bundle. optional filterMeta: object; ``` -Defined in: [types/TableFeatures.ts:266](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L266) +Defined in: [types/TableFeatures.ts:269](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L269) Type-only slot for declaring the type of the filter meta that filter functions attach to rows via `addMeta` and that is read back from @@ -520,7 +520,7 @@ Defined in: [features/stockFeatures.ts:27](https://github.com/TanStack/table/blo optional groupedRowModel: (table) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:272](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L272) +Defined in: [types/TableFeatures.ts:275](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L275) Factory for the client-side grouped row model. Pass the exported `createGroupedRowModel()` or implement your own. Not needed for @@ -550,7 +550,7 @@ server-side grouping. optional paginatedRowModel: (table) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:278](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L278) +Defined in: [types/TableFeatures.ts:281](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L281) Factory for the client-side paginated row model. Pass the exported `createPaginatedRowModel()` or implement your own. Not needed for @@ -664,7 +664,7 @@ Defined in: [features/stockFeatures.ts:32](https://github.com/TanStack/table/blo optional sortedRowModel: (table) => () => RowModel; ``` -Defined in: [types/TableFeatures.ts:284](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L284) +Defined in: [types/TableFeatures.ts:287](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L287) Factory for the client-side sorted row model. Pass the exported `createSortedRowModel()` or implement your own. Not needed for @@ -694,7 +694,7 @@ server-side sorting. optional sortFns: Record>; ``` -Defined in: [types/TableFeatures.ts:295](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L295) +Defined in: [types/TableFeatures.ts:298](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L298) Registry of sorting functions available to this table by name. @@ -713,7 +713,7 @@ sorting function in your bundle. optional tableMeta: object; ``` -Defined in: [types/TableFeatures.ts:305](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L305) +Defined in: [types/TableFeatures.ts:308](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L308) Type-only slot for declaring the type of this table's `options.meta`. diff --git a/docs/reference/index/interfaces/TableMeta.md b/docs/reference/index/interfaces/TableMeta.md index a837e9843b..b3df9ea1d4 100644 --- a/docs/reference/index/interfaces/TableMeta.md +++ b/docs/reference/index/interfaces/TableMeta.md @@ -5,7 +5,7 @@ title: TableMeta # Interface: TableMeta\ -Defined in: [core/table/coreTablesFeature.types.ts:16](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L16) +Defined in: [core/table/coreTablesFeature.types.ts:17](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L17) ## Type Parameters diff --git a/docs/reference/index/interfaces/TableOptions_Core.md b/docs/reference/index/interfaces/TableOptions_Core.md index 68bb5a4bcb..e3e71d730d 100644 --- a/docs/reference/index/interfaces/TableOptions_Core.md +++ b/docs/reference/index/interfaces/TableOptions_Core.md @@ -32,7 +32,7 @@ options are mixed in. readonly optional atoms: Partial<{ [K in string | number | symbol]: Atom[K]> }>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:108](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L108) +Defined in: [core/table/coreTablesFeature.types.ts:109](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L109) Optionally, provide your own external writable atoms for individual state slices. When an atom is provided for a given slice, it takes precedence over `options.state[key]` @@ -52,7 +52,7 @@ model for app-managed table state slices. readonly optional autoResetAll: boolean; ``` -Defined in: [core/table/coreTablesFeature.types.ts:112](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L112) +Defined in: [core/table/coreTablesFeature.types.ts:113](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L113) Set this option to override any of the `autoReset...` feature options. @@ -84,7 +84,7 @@ The array of column defs to use for the table. readonly data: readonly TData[]; ``` -Defined in: [core/table/coreTablesFeature.types.ts:116](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L116) +Defined in: [core/table/coreTablesFeature.types.ts:117](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L117) The data for the table to display. When the `data` option changes reference, the table will reprocess the data. @@ -116,7 +116,7 @@ Default column options to use for all column defs supplied to the table. readonly features: TFeatures & ValidateFeatureSlots; ``` -Defined in: [core/table/coreTablesFeature.types.ts:100](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L100) +Defined in: [core/table/coreTablesFeature.types.ts:101](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L101) The feature modules registered on this table instance. @@ -214,7 +214,7 @@ getSubRows: row => row.subRows readonly optional initialState: Partial>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:130](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L130) +Defined in: [core/table/coreTablesFeature.types.ts:131](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L131) Optionally provide starting values for registered table state slices. Feature reset APIs use this value by default, and many reset APIs accept @@ -233,7 +233,7 @@ object later does not reset table state, so it does not need to be stable. readonly optional key: string; ``` -Defined in: [core/table/coreTablesFeature.types.ts:123](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L123) +Defined in: [core/table/coreTablesFeature.types.ts:124](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L124) Optional key used to identify this table instance. @@ -252,7 +252,7 @@ not required unless the table is passed to devtools. readonly optional mergeOptions: (defaultOptions, options) => TableOptions; ``` -Defined in: [core/table/coreTablesFeature.types.ts:134](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L134) +Defined in: [core/table/coreTablesFeature.types.ts:135](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L135) This option is used to optionally implement the merging of table options. @@ -282,7 +282,7 @@ This option is used to optionally implement the merging of table options. readonly optional meta: ExtractTableMeta; ``` -Defined in: [core/table/coreTablesFeature.types.ts:144](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L144) +Defined in: [core/table/coreTablesFeature.types.ts:145](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L145) You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`. @@ -317,7 +317,7 @@ Value used when the desired value is not found in the data. readonly optional state: Partial>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:152](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L152) +Defined in: [core/table/coreTablesFeature.types.ts:153](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L153) Optionally provide externally managed values for individual state slices. diff --git a/docs/reference/index/interfaces/TableOptions_Table.md b/docs/reference/index/interfaces/TableOptions_Table.md index c01fc9f5b4..8bb8f5c2c2 100644 --- a/docs/reference/index/interfaces/TableOptions_Table.md +++ b/docs/reference/index/interfaces/TableOptions_Table.md @@ -5,7 +5,7 @@ title: TableOptions_Table # Interface: TableOptions\_Table\ -Defined in: [core/table/coreTablesFeature.types.ts:87](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L87) +Defined in: [core/table/coreTablesFeature.types.ts:88](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L88) ## Extended by @@ -29,7 +29,7 @@ Defined in: [core/table/coreTablesFeature.types.ts:87](https://github.com/TanSta readonly optional atoms: Partial<{ [K in string | number | symbol]: Atom[K]> }>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:108](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L108) +Defined in: [core/table/coreTablesFeature.types.ts:109](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L109) Optionally, provide your own external writable atoms for individual state slices. When an atom is provided for a given slice, it takes precedence over `options.state[key]` @@ -45,7 +45,7 @@ model for app-managed table state slices. readonly optional autoResetAll: boolean; ``` -Defined in: [core/table/coreTablesFeature.types.ts:112](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L112) +Defined in: [core/table/coreTablesFeature.types.ts:113](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L113) Set this option to override any of the `autoReset...` feature options. @@ -57,7 +57,7 @@ Set this option to override any of the `autoReset...` feature options. readonly data: readonly TData[]; ``` -Defined in: [core/table/coreTablesFeature.types.ts:116](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L116) +Defined in: [core/table/coreTablesFeature.types.ts:117](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L117) The data for the table to display. When the `data` option changes reference, the table will reprocess the data. @@ -69,7 +69,7 @@ The data for the table to display. When the `data` option changes reference, the readonly features: TFeatures & ValidateFeatureSlots; ``` -Defined in: [core/table/coreTablesFeature.types.ts:100](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L100) +Defined in: [core/table/coreTablesFeature.types.ts:101](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L101) The feature modules registered on this table instance. @@ -87,7 +87,7 @@ slots (`tableMeta`, `columnMeta`). readonly optional initialState: Partial>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:130](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L130) +Defined in: [core/table/coreTablesFeature.types.ts:131](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L131) Optionally provide starting values for registered table state slices. Feature reset APIs use this value by default, and many reset APIs accept @@ -102,7 +102,7 @@ object later does not reset table state, so it does not need to be stable. readonly optional key: string; ``` -Defined in: [core/table/coreTablesFeature.types.ts:123](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L123) +Defined in: [core/table/coreTablesFeature.types.ts:124](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L124) Optional key used to identify this table instance. @@ -117,7 +117,7 @@ not required unless the table is passed to devtools. readonly optional mergeOptions: (defaultOptions, options) => TableOptions; ``` -Defined in: [core/table/coreTablesFeature.types.ts:134](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L134) +Defined in: [core/table/coreTablesFeature.types.ts:135](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L135) This option is used to optionally implement the merging of table options. @@ -143,7 +143,7 @@ This option is used to optionally implement the merging of table options. readonly optional meta: ExtractTableMeta; ``` -Defined in: [core/table/coreTablesFeature.types.ts:144](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L144) +Defined in: [core/table/coreTablesFeature.types.ts:145](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L145) You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`. @@ -158,7 +158,7 @@ Declare its type per-table via the `tableMeta` type-only slot on the readonly optional state: Partial>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:152](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L152) +Defined in: [core/table/coreTablesFeature.types.ts:153](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L153) Optionally provide externally managed values for individual state slices. diff --git a/docs/reference/index/interfaces/Table_Core.md b/docs/reference/index/interfaces/Table_Core.md index 72a2e66a88..bb055303ca 100644 --- a/docs/reference/index/interfaces/Table_Core.md +++ b/docs/reference/index/interfaces/Table_Core.md @@ -26,13 +26,53 @@ No features are included. ## Properties +### \_cellInstanceInitFns? + +```ts +optional _cellInstanceInitFns: (cell) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:167](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L167) + +Cache of the `initCellInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### cell + +[`Cell`](../type-aliases/Cell.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_Table`](Table_Table.md).[`_cellInstanceInitFns`](Table_Table.md#_cellinstanceinitfns) + +*** + ### \_cellPrototype? ```ts optional _cellPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:166](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L166) +Defined in: [core/table/coreTablesFeature.types.ts:173](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L173) Prototype cache for Cell objects - shared by all cells in this table @@ -42,13 +82,53 @@ Prototype cache for Cell objects - shared by all cells in this table *** +### \_columnInstanceInitFns? + +```ts +optional _columnInstanceInitFns: (column) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:177](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L177) + +Cache of the `initColumnInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### column + +[`Column`](../type-aliases/Column.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_Table`](Table_Table.md).[`_columnInstanceInitFns`](Table_Table.md#_columninstanceinitfns) + +*** + ### \_columnPrototype? ```ts optional _columnPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:170](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L170) +Defined in: [core/table/coreTablesFeature.types.ts:183](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L183) Prototype cache for Column objects - shared by all columns in this table @@ -64,7 +144,7 @@ Prototype cache for Column objects - shared by all columns in this table readonly _features: Partial & TFeatures; ``` -Defined in: [core/table/coreTablesFeature.types.ts:174](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L174) +Defined in: [core/table/coreTablesFeature.types.ts:187](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L187) The features that are enabled for the table. @@ -74,13 +154,89 @@ The features that are enabled for the table. *** +### \_headerGroupInstanceInitFns? + +```ts +optional _headerGroupInstanceInitFns: (headerGroup) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:191](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L191) + +Cache of the `initHeaderGroupInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### headerGroup + +[`HeaderGroup`](HeaderGroup.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_Table`](Table_Table.md).[`_headerGroupInstanceInitFns`](Table_Table.md#_headergroupinstanceinitfns) + +*** + +### \_headerInstanceInitFns? + +```ts +optional _headerInstanceInitFns: (header) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:197](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L197) + +Cache of the `initHeaderInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### header + +[`Header`](../type-aliases/Header.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_Table`](Table_Table.md).[`_headerInstanceInitFns`](Table_Table.md#_headerinstanceinitfns) + +*** + ### \_headerPrototype? ```ts optional _headerPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:178](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L178) +Defined in: [core/table/coreTablesFeature.types.ts:203](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L203) Prototype cache for Header objects - shared by all headers in this table @@ -96,7 +252,7 @@ Prototype cache for Header objects - shared by all headers in this table readonly _reactivity: TableReactivityBindings; ``` -Defined in: [core/table/coreTablesFeature.types.ts:162](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L162) +Defined in: [core/table/coreTablesFeature.types.ts:163](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L163) Table reactivity bindings for interacting with TanStack Store. @@ -106,13 +262,49 @@ Table reactivity bindings for interacting with TanStack Store. *** +### \_rowInstanceInitFns? + +```ts +optional _rowInstanceInitFns: (row) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:219](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L219) + +Cache of the `initRowInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### row + +[`Row`](../type-aliases/Row.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_Table`](Table_Table.md).[`_rowInstanceInitFns`](Table_Table.md#_rowinstanceinitfns) + +*** + ### \_rowModelFns ```ts readonly _rowModelFns: RowModelFns; ``` -Defined in: [core/table/coreTablesFeature.types.ts:182](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L182) +Defined in: [core/table/coreTablesFeature.types.ts:207](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L207) The row model processing functions that are used to process the data by features. @@ -128,7 +320,7 @@ The row model processing functions that are used to process the data by features readonly _rowModels: CachedRowModels; ``` -Defined in: [core/table/coreTablesFeature.types.ts:186](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L186) +Defined in: [core/table/coreTablesFeature.types.ts:211](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L211) The row models that are enabled for the table. @@ -144,7 +336,7 @@ The row models that are enabled for the table. optional _rowPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:190](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L190) +Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) Prototype cache for Row objects - shared by all rows in this table @@ -160,7 +352,7 @@ Prototype cache for Row objects - shared by all rows in this table readonly atoms: Atoms; ``` -Defined in: [core/table/coreTablesFeature.types.ts:196](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L196) +Defined in: [core/table/coreTablesFeature.types.ts:225](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L225) The readonly derived atoms for each `TableState` slice. Each derives from its corresponding `baseAtom` plus, optionally, a per-slice external atom or @@ -178,7 +370,7 @@ external state value (precedence: external atom > external state > base atom). readonly baseAtoms: BaseAtoms; ``` -Defined in: [core/table/coreTablesFeature.types.ts:201](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L201) +Defined in: [core/table/coreTablesFeature.types.ts:230](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L230) The internal writable atoms for each `TableState` slice. This is the library's single write surface — all state mutations from features land here. @@ -870,7 +1062,7 @@ Table_RowModels.getSortedRowModel readonly initialState: ExtractFeatureMapTypes; ``` -Defined in: [core/table/coreTablesFeature.types.ts:205](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L205) +Defined in: [core/table/coreTablesFeature.types.ts:234](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L234) This is the resolved initial state of the table. @@ -886,7 +1078,7 @@ This is the resolved initial state of the table. readonly options: TableOptions; ``` -Defined in: [core/table/coreTablesFeature.types.ts:209](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L209) +Defined in: [core/table/coreTablesFeature.types.ts:238](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L238) A read-only reference to the table's current options. @@ -902,7 +1094,7 @@ A read-only reference to the table's current options. readonly optional optionsStore: Atom>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) +Defined in: [core/table/coreTablesFeature.types.ts:244](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L244) Writable atom for table options. Only created when `createOptionsStore` is true on the active core reactivity bindings. Adapters that opt out keep @@ -920,7 +1112,7 @@ options as plain resolved data instead of backing them with an atom. reset: () => void; ``` -Defined in: [core/table/coreTablesFeature.types.ts:235](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L235) +Defined in: [core/table/coreTablesFeature.types.ts:264](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L264) Resets the table's internal base atoms to `table.initialState`. @@ -945,7 +1137,7 @@ reset hooks for mutable, transient table-instance data. setOptions: (newOptions) => void; ``` -Defined in: [core/table/coreTablesFeature.types.ts:240](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L240) +Defined in: [core/table/coreTablesFeature.types.ts:269](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L269) Updates the table options by applying a value or updater to the current resolved options and then merging them through `options.mergeOptions`. @@ -972,7 +1164,7 @@ resolved options and then merging them through `options.mergeOptions`. readonly store: ReadonlyStore>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:220](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L220) +Defined in: [core/table/coreTablesFeature.types.ts:249](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L249) The readonly flat store for the table state. Derives from `table.atoms` only; never reads external state directly. diff --git a/docs/reference/index/interfaces/Table_CoreProperties.md b/docs/reference/index/interfaces/Table_CoreProperties.md index 32d3310b72..322a1130b6 100644 --- a/docs/reference/index/interfaces/Table_CoreProperties.md +++ b/docs/reference/index/interfaces/Table_CoreProperties.md @@ -5,7 +5,7 @@ title: Table_CoreProperties # Interface: Table\_CoreProperties\ -Defined in: [core/table/coreTablesFeature.types.ts:155](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L155) +Defined in: [core/table/coreTablesFeature.types.ts:156](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L156) ## Extended by @@ -23,25 +23,97 @@ Defined in: [core/table/coreTablesFeature.types.ts:155](https://github.com/TanSt ## Properties +### \_cellInstanceInitFns? + +```ts +optional _cellInstanceInitFns: (cell) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:167](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L167) + +Cache of the `initCellInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### cell + +[`Cell`](../type-aliases/Cell.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +*** + ### \_cellPrototype? ```ts optional _cellPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:166](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L166) +Defined in: [core/table/coreTablesFeature.types.ts:173](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L173) Prototype cache for Cell objects - shared by all cells in this table *** +### \_columnInstanceInitFns? + +```ts +optional _columnInstanceInitFns: (column) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:177](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L177) + +Cache of the `initColumnInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### column + +[`Column`](../type-aliases/Column.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +*** + ### \_columnPrototype? ```ts optional _columnPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:170](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L170) +Defined in: [core/table/coreTablesFeature.types.ts:183](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L183) Prototype cache for Column objects - shared by all columns in this table @@ -53,19 +125,87 @@ Prototype cache for Column objects - shared by all columns in this table readonly _features: Partial & TFeatures; ``` -Defined in: [core/table/coreTablesFeature.types.ts:174](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L174) +Defined in: [core/table/coreTablesFeature.types.ts:187](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L187) The features that are enabled for the table. *** +### \_headerGroupInstanceInitFns? + +```ts +optional _headerGroupInstanceInitFns: (headerGroup) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:191](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L191) + +Cache of the `initHeaderGroupInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### headerGroup + +[`HeaderGroup`](HeaderGroup.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +*** + +### \_headerInstanceInitFns? + +```ts +optional _headerInstanceInitFns: (header) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:197](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L197) + +Cache of the `initHeaderInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### header + +[`Header`](../type-aliases/Header.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +*** + ### \_headerPrototype? ```ts optional _headerPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:178](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L178) +Defined in: [core/table/coreTablesFeature.types.ts:203](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L203) Prototype cache for Header objects - shared by all headers in this table @@ -77,19 +217,51 @@ Prototype cache for Header objects - shared by all headers in this table readonly _reactivity: TableReactivityBindings; ``` -Defined in: [core/table/coreTablesFeature.types.ts:162](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L162) +Defined in: [core/table/coreTablesFeature.types.ts:163](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L163) Table reactivity bindings for interacting with TanStack Store. *** +### \_rowInstanceInitFns? + +```ts +optional _rowInstanceInitFns: (row) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:219](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L219) + +Cache of the `initRowInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### row + +[`Row`](../type-aliases/Row.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +*** + ### \_rowModelFns ```ts readonly _rowModelFns: RowModelFns; ``` -Defined in: [core/table/coreTablesFeature.types.ts:182](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L182) +Defined in: [core/table/coreTablesFeature.types.ts:207](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L207) The row model processing functions that are used to process the data by features. @@ -101,7 +273,7 @@ The row model processing functions that are used to process the data by features readonly _rowModels: CachedRowModels; ``` -Defined in: [core/table/coreTablesFeature.types.ts:186](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L186) +Defined in: [core/table/coreTablesFeature.types.ts:211](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L211) The row models that are enabled for the table. @@ -113,7 +285,7 @@ The row models that are enabled for the table. optional _rowPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:190](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L190) +Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) Prototype cache for Row objects - shared by all rows in this table @@ -125,7 +297,7 @@ Prototype cache for Row objects - shared by all rows in this table readonly atoms: Atoms; ``` -Defined in: [core/table/coreTablesFeature.types.ts:196](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L196) +Defined in: [core/table/coreTablesFeature.types.ts:225](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L225) The readonly derived atoms for each `TableState` slice. Each derives from its corresponding `baseAtom` plus, optionally, a per-slice external atom or @@ -139,7 +311,7 @@ external state value (precedence: external atom > external state > base atom). readonly baseAtoms: BaseAtoms; ``` -Defined in: [core/table/coreTablesFeature.types.ts:201](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L201) +Defined in: [core/table/coreTablesFeature.types.ts:230](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L230) The internal writable atoms for each `TableState` slice. This is the library's single write surface — all state mutations from features land here. @@ -152,7 +324,7 @@ single write surface — all state mutations from features land here. readonly initialState: ExtractFeatureMapTypes; ``` -Defined in: [core/table/coreTablesFeature.types.ts:205](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L205) +Defined in: [core/table/coreTablesFeature.types.ts:234](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L234) This is the resolved initial state of the table. @@ -164,7 +336,7 @@ This is the resolved initial state of the table. readonly options: TableOptions; ``` -Defined in: [core/table/coreTablesFeature.types.ts:209](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L209) +Defined in: [core/table/coreTablesFeature.types.ts:238](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L238) A read-only reference to the table's current options. @@ -176,7 +348,7 @@ A read-only reference to the table's current options. readonly optional optionsStore: Atom>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) +Defined in: [core/table/coreTablesFeature.types.ts:244](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L244) Writable atom for table options. Only created when `createOptionsStore` is true on the active core reactivity bindings. Adapters that opt out keep @@ -190,7 +362,7 @@ options as plain resolved data instead of backing them with an atom. readonly store: ReadonlyStore>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:220](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L220) +Defined in: [core/table/coreTablesFeature.types.ts:249](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L249) The readonly flat store for the table state. Derives from `table.atoms` only; never reads external state directly. diff --git a/docs/reference/index/interfaces/Table_Internal.md b/docs/reference/index/interfaces/Table_Internal.md index 1e9f33a695..9fd49471da 100644 --- a/docs/reference/index/interfaces/Table_Internal.md +++ b/docs/reference/index/interfaces/Table_Internal.md @@ -25,13 +25,55 @@ Internal broad table shape used by feature implementations. ## Properties +### \_cellInstanceInitFns? + +```ts +optional _cellInstanceInitFns: (cell) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:167](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L167) + +Cache of the `initCellInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### cell + +[`Cell`](../type-aliases/Cell.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit._cellInstanceInitFns +``` + +*** + ### \_cellPrototype? ```ts optional _cellPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:166](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L166) +Defined in: [core/table/coreTablesFeature.types.ts:173](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L173) Prototype cache for Cell objects - shared by all cells in this table @@ -41,13 +83,55 @@ Prototype cache for Cell objects - shared by all cells in this table *** +### \_columnInstanceInitFns? + +```ts +optional _columnInstanceInitFns: (column) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:177](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L177) + +Cache of the `initColumnInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### column + +[`Column`](../type-aliases/Column.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit._columnInstanceInitFns +``` + +*** + ### \_columnPrototype? ```ts optional _columnPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:170](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L170) +Defined in: [core/table/coreTablesFeature.types.ts:183](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L183) Prototype cache for Column objects - shared by all columns in this table @@ -63,7 +147,7 @@ Prototype cache for Column objects - shared by all columns in this table readonly _features: Partial & TFeatures; ``` -Defined in: [core/table/coreTablesFeature.types.ts:174](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L174) +Defined in: [core/table/coreTablesFeature.types.ts:187](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L187) The features that are enabled for the table. @@ -75,13 +159,93 @@ Omit._features *** +### \_headerGroupInstanceInitFns? + +```ts +optional _headerGroupInstanceInitFns: (headerGroup) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:191](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L191) + +Cache of the `initHeaderGroupInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### headerGroup + +[`HeaderGroup`](HeaderGroup.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit._headerGroupInstanceInitFns +``` + +*** + +### \_headerInstanceInitFns? + +```ts +optional _headerInstanceInitFns: (header) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:197](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L197) + +Cache of the `initHeaderInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### header + +[`Header`](../type-aliases/Header.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit._headerInstanceInitFns +``` + +*** + ### \_headerPrototype? ```ts optional _headerPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:178](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L178) +Defined in: [core/table/coreTablesFeature.types.ts:203](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L203) Prototype cache for Header objects - shared by all headers in this table @@ -97,7 +261,7 @@ Prototype cache for Header objects - shared by all headers in this table readonly _reactivity: TableReactivityBindings; ``` -Defined in: [core/table/coreTablesFeature.types.ts:162](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L162) +Defined in: [core/table/coreTablesFeature.types.ts:163](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L163) Table reactivity bindings for interacting with TanStack Store. @@ -107,6 +271,44 @@ Table reactivity bindings for interacting with TanStack Store. *** +### \_rowInstanceInitFns? + +```ts +optional _rowInstanceInitFns: (row) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:219](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L219) + +Cache of the `initRowInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### row + +[`Row`](../type-aliases/Row.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +#### Inherited from + +```ts +Omit._rowInstanceInitFns +``` + +*** + ### \_rowModelFns ```ts @@ -133,7 +335,7 @@ Defined in: [types/Table.ts:104](https://github.com/TanStack/table/blob/main/pac optional _rowPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:190](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L190) +Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) Prototype cache for Row objects - shared by all rows in this table @@ -961,7 +1163,7 @@ optional state: TableState_All; readonly optional optionsStore: Atom>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) +Defined in: [core/table/coreTablesFeature.types.ts:244](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L244) Writable atom for table options. Only created when `createOptionsStore` is true on the active core reactivity bindings. Adapters that opt out keep @@ -981,7 +1183,7 @@ Omit.optionsStore reset: () => void; ``` -Defined in: [core/table/coreTablesFeature.types.ts:235](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L235) +Defined in: [core/table/coreTablesFeature.types.ts:264](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L264) Resets the table's internal base atoms to `table.initialState`. @@ -1008,7 +1210,7 @@ Omit.reset setOptions: (newOptions) => void; ``` -Defined in: [core/table/coreTablesFeature.types.ts:240](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L240) +Defined in: [core/table/coreTablesFeature.types.ts:269](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L269) Updates the table options by applying a value or updater to the current resolved options and then merging them through `options.mergeOptions`. diff --git a/docs/reference/index/interfaces/Table_Table.md b/docs/reference/index/interfaces/Table_Table.md index 438262fb77..edc13ea2c3 100644 --- a/docs/reference/index/interfaces/Table_Table.md +++ b/docs/reference/index/interfaces/Table_Table.md @@ -5,7 +5,7 @@ title: Table_Table # Interface: Table\_Table\ -Defined in: [core/table/coreTablesFeature.types.ts:223](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L223) +Defined in: [core/table/coreTablesFeature.types.ts:252](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L252) ## Extends @@ -27,13 +27,53 @@ Defined in: [core/table/coreTablesFeature.types.ts:223](https://github.com/TanSt ## Properties +### \_cellInstanceInitFns? + +```ts +optional _cellInstanceInitFns: (cell) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:167](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L167) + +Cache of the `initCellInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### cell + +[`Cell`](../type-aliases/Cell.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_CoreProperties`](Table_CoreProperties.md).[`_cellInstanceInitFns`](Table_CoreProperties.md#_cellinstanceinitfns) + +*** + ### \_cellPrototype? ```ts optional _cellPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:166](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L166) +Defined in: [core/table/coreTablesFeature.types.ts:173](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L173) Prototype cache for Cell objects - shared by all cells in this table @@ -43,13 +83,53 @@ Prototype cache for Cell objects - shared by all cells in this table *** +### \_columnInstanceInitFns? + +```ts +optional _columnInstanceInitFns: (column) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:177](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L177) + +Cache of the `initColumnInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### column + +[`Column`](../type-aliases/Column.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_CoreProperties`](Table_CoreProperties.md).[`_columnInstanceInitFns`](Table_CoreProperties.md#_columninstanceinitfns) + +*** + ### \_columnPrototype? ```ts optional _columnPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:170](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L170) +Defined in: [core/table/coreTablesFeature.types.ts:183](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L183) Prototype cache for Column objects - shared by all columns in this table @@ -65,7 +145,7 @@ Prototype cache for Column objects - shared by all columns in this table readonly _features: Partial & TFeatures; ``` -Defined in: [core/table/coreTablesFeature.types.ts:174](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L174) +Defined in: [core/table/coreTablesFeature.types.ts:187](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L187) The features that are enabled for the table. @@ -75,13 +155,89 @@ The features that are enabled for the table. *** +### \_headerGroupInstanceInitFns? + +```ts +optional _headerGroupInstanceInitFns: (headerGroup) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:191](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L191) + +Cache of the `initHeaderGroupInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### headerGroup + +[`HeaderGroup`](HeaderGroup.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_CoreProperties`](Table_CoreProperties.md).[`_headerGroupInstanceInitFns`](Table_CoreProperties.md#_headergroupinstanceinitfns) + +*** + +### \_headerInstanceInitFns? + +```ts +optional _headerInstanceInitFns: (header) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:197](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L197) + +Cache of the `initHeaderInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +##### TValue + +`TValue` *extends* `unknown` = `unknown` + +#### Parameters + +##### header + +[`Header`](../type-aliases/Header.md)\<`TFeatures`, `TData`, `TValue`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_CoreProperties`](Table_CoreProperties.md).[`_headerInstanceInitFns`](Table_CoreProperties.md#_headerinstanceinitfns) + +*** + ### \_headerPrototype? ```ts optional _headerPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:178](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L178) +Defined in: [core/table/coreTablesFeature.types.ts:203](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L203) Prototype cache for Header objects - shared by all headers in this table @@ -97,7 +253,7 @@ Prototype cache for Header objects - shared by all headers in this table readonly _reactivity: TableReactivityBindings; ``` -Defined in: [core/table/coreTablesFeature.types.ts:162](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L162) +Defined in: [core/table/coreTablesFeature.types.ts:163](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L163) Table reactivity bindings for interacting with TanStack Store. @@ -107,13 +263,49 @@ Table reactivity bindings for interacting with TanStack Store. *** +### \_rowInstanceInitFns? + +```ts +optional _rowInstanceInitFns: (row) => void[]; +``` + +Defined in: [core/table/coreTablesFeature.types.ts:219](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L219) + +Cache of the `initRowInstanceData` functions for features that define one. + +#### Type Parameters + +##### TFeatures + +`TFeatures` *extends* [`TableFeatures`](TableFeatures.md) + +##### TData + +`TData` *extends* [`RowData`](../type-aliases/RowData.md) + +#### Parameters + +##### row + +[`Row`](../type-aliases/Row.md)\<`TFeatures`, `TData`\> + +#### Returns + +`void` + +#### Inherited from + +[`Table_CoreProperties`](Table_CoreProperties.md).[`_rowInstanceInitFns`](Table_CoreProperties.md#_rowinstanceinitfns) + +*** + ### \_rowModelFns ```ts readonly _rowModelFns: RowModelFns; ``` -Defined in: [core/table/coreTablesFeature.types.ts:182](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L182) +Defined in: [core/table/coreTablesFeature.types.ts:207](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L207) The row model processing functions that are used to process the data by features. @@ -129,7 +321,7 @@ The row model processing functions that are used to process the data by features readonly _rowModels: CachedRowModels; ``` -Defined in: [core/table/coreTablesFeature.types.ts:186](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L186) +Defined in: [core/table/coreTablesFeature.types.ts:211](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L211) The row models that are enabled for the table. @@ -145,7 +337,7 @@ The row models that are enabled for the table. optional _rowPrototype: object; ``` -Defined in: [core/table/coreTablesFeature.types.ts:190](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L190) +Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) Prototype cache for Row objects - shared by all rows in this table @@ -161,7 +353,7 @@ Prototype cache for Row objects - shared by all rows in this table readonly atoms: Atoms; ``` -Defined in: [core/table/coreTablesFeature.types.ts:196](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L196) +Defined in: [core/table/coreTablesFeature.types.ts:225](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L225) The readonly derived atoms for each `TableState` slice. Each derives from its corresponding `baseAtom` plus, optionally, a per-slice external atom or @@ -179,7 +371,7 @@ external state value (precedence: external atom > external state > base atom). readonly baseAtoms: BaseAtoms; ``` -Defined in: [core/table/coreTablesFeature.types.ts:201](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L201) +Defined in: [core/table/coreTablesFeature.types.ts:230](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L230) The internal writable atoms for each `TableState` slice. This is the library's single write surface — all state mutations from features land here. @@ -196,7 +388,7 @@ single write surface — all state mutations from features land here. readonly initialState: ExtractFeatureMapTypes; ``` -Defined in: [core/table/coreTablesFeature.types.ts:205](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L205) +Defined in: [core/table/coreTablesFeature.types.ts:234](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L234) This is the resolved initial state of the table. @@ -212,7 +404,7 @@ This is the resolved initial state of the table. readonly options: TableOptions; ``` -Defined in: [core/table/coreTablesFeature.types.ts:209](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L209) +Defined in: [core/table/coreTablesFeature.types.ts:238](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L238) A read-only reference to the table's current options. @@ -228,7 +420,7 @@ A read-only reference to the table's current options. readonly optional optionsStore: Atom>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:215](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L215) +Defined in: [core/table/coreTablesFeature.types.ts:244](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L244) Writable atom for table options. Only created when `createOptionsStore` is true on the active core reactivity bindings. Adapters that opt out keep @@ -246,7 +438,7 @@ options as plain resolved data instead of backing them with an atom. reset: () => void; ``` -Defined in: [core/table/coreTablesFeature.types.ts:235](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L235) +Defined in: [core/table/coreTablesFeature.types.ts:264](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L264) Resets the table's internal base atoms to `table.initialState`. @@ -267,7 +459,7 @@ reset hooks for mutable, transient table-instance data. setOptions: (newOptions) => void; ``` -Defined in: [core/table/coreTablesFeature.types.ts:240](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L240) +Defined in: [core/table/coreTablesFeature.types.ts:269](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L269) Updates the table options by applying a value or updater to the current resolved options and then merging them through `options.mergeOptions`. @@ -290,7 +482,7 @@ resolved options and then merging them through `options.mergeOptions`. readonly store: ReadonlyStore>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:220](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L220) +Defined in: [core/table/coreTablesFeature.types.ts:249](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L249) The readonly flat store for the table state. Derives from `table.atoms` only; never reads external state directly. diff --git a/docs/reference/index/type-aliases/Atoms.md b/docs/reference/index/type-aliases/Atoms.md index aa6927e161..a31812282d 100644 --- a/docs/reference/index/type-aliases/Atoms.md +++ b/docs/reference/index/type-aliases/Atoms.md @@ -9,7 +9,7 @@ title: Atoms type Atoms = { [K in keyof TableState]-?: ReadonlyAtom[K]> }; ``` -Defined in: [core/table/coreTablesFeature.types.ts:54](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L54) +Defined in: [core/table/coreTablesFeature.types.ts:55](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L55) A map of readonly derived atoms, one per `TableState` slice. Each derives from its corresponding `baseAtom` plus, optionally, a per-slice external diff --git a/docs/reference/index/type-aliases/Atoms_All.md b/docs/reference/index/type-aliases/Atoms_All.md index dd42c9523e..c965cc6dd6 100644 --- a/docs/reference/index/type-aliases/Atoms_All.md +++ b/docs/reference/index/type-aliases/Atoms_All.md @@ -9,4 +9,4 @@ title: Atoms_All type Atoms_All = { [K in keyof TableState_All]?: ReadonlyAtom }; ``` -Defined in: [core/table/coreTablesFeature.types.ts:80](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L80) +Defined in: [core/table/coreTablesFeature.types.ts:81](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L81) diff --git a/docs/reference/index/type-aliases/BaseAtoms.md b/docs/reference/index/type-aliases/BaseAtoms.md index bee16972f8..e24d1c7707 100644 --- a/docs/reference/index/type-aliases/BaseAtoms.md +++ b/docs/reference/index/type-aliases/BaseAtoms.md @@ -9,7 +9,7 @@ title: BaseAtoms type BaseAtoms = { [K in keyof TableState]-?: Atom[K]> }; ``` -Defined in: [core/table/coreTablesFeature.types.ts:43](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L43) +Defined in: [core/table/coreTablesFeature.types.ts:44](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L44) A map of writable atoms, one per `TableState` slice. These are the internal writable atoms that the library always writes to via `makeStateUpdater`. diff --git a/docs/reference/index/type-aliases/BaseAtoms_All.md b/docs/reference/index/type-aliases/BaseAtoms_All.md index ffbdadd9b8..9bef86d951 100644 --- a/docs/reference/index/type-aliases/BaseAtoms_All.md +++ b/docs/reference/index/type-aliases/BaseAtoms_All.md @@ -9,7 +9,7 @@ title: BaseAtoms_All type BaseAtoms_All = { [K in keyof TableState_All]?: Atom> }; ``` -Defined in: [core/table/coreTablesFeature.types.ts:77](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L77) +Defined in: [core/table/coreTablesFeature.types.ts:78](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L78) Internal "all features" flat variants of the atom types. `Table_Internal` uses these so feature code (written generically over `TFeatures`) can access diff --git a/docs/reference/index/type-aliases/BuiltInAggregationFn.md b/docs/reference/index/type-aliases/BuiltInAggregationFn.md index c131b526fb..9c567e4f25 100644 --- a/docs/reference/index/type-aliases/BuiltInAggregationFn.md +++ b/docs/reference/index/type-aliases/BuiltInAggregationFn.md @@ -9,4 +9,4 @@ title: BuiltInAggregationFn type BuiltInAggregationFn = keyof typeof aggregationFns; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:345](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L345) +Defined in: [features/row-aggregation/aggregationFns.ts:383](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L383) diff --git a/docs/reference/index/type-aliases/ColumnDefResolved.md b/docs/reference/index/type-aliases/ColumnDefResolved.md index 6ae3d58e84..0dfa25fb6c 100644 --- a/docs/reference/index/type-aliases/ColumnDefResolved.md +++ b/docs/reference/index/type-aliases/ColumnDefResolved.md @@ -16,7 +16,7 @@ Defined in: [types/ColumnDef.ts:252](https://github.com/TanStack/table/blob/main ### accessorKey? ```ts -optional accessorKey: string; +optional accessorKey: string & object | keyof TData; ``` ## Type Parameters diff --git a/docs/reference/index/type-aliases/DeepValue.md b/docs/reference/index/type-aliases/DeepValue.md index 4101923fb3..e268f6dd83 100644 --- a/docs/reference/index/type-aliases/DeepValue.md +++ b/docs/reference/index/type-aliases/DeepValue.md @@ -6,7 +6,7 @@ title: DeepValue # Type Alias: DeepValue\ ```ts -type DeepValue = T extends Record ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue : T[TProp & string] : never; +type DeepValue = T extends Record ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue : T[TProp & keyof T] : never; ``` Defined in: [types/type-utils.ts:79](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/type-utils.ts#L79) diff --git a/docs/reference/index/type-aliases/ExternalAtoms.md b/docs/reference/index/type-aliases/ExternalAtoms.md index 9ca299caf4..1de06a4f69 100644 --- a/docs/reference/index/type-aliases/ExternalAtoms.md +++ b/docs/reference/index/type-aliases/ExternalAtoms.md @@ -9,7 +9,7 @@ title: ExternalAtoms type ExternalAtoms = Partial<{ [K in keyof TableState]: Atom[K]> }>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:63](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L63) +Defined in: [core/table/coreTablesFeature.types.ts:64](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L64) A map of optional external atoms, one per `TableState` slice. Consumers can provide their own writable atom for any state slice to take over ownership diff --git a/docs/reference/index/type-aliases/ExternalAtoms_All.md b/docs/reference/index/type-aliases/ExternalAtoms_All.md index 3c755c1df8..450fc7a09c 100644 --- a/docs/reference/index/type-aliases/ExternalAtoms_All.md +++ b/docs/reference/index/type-aliases/ExternalAtoms_All.md @@ -9,4 +9,4 @@ title: ExternalAtoms_All type ExternalAtoms_All = Partial<{ [K in keyof TableState_All]: Atom> }>; ``` -Defined in: [core/table/coreTablesFeature.types.ts:83](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L83) +Defined in: [core/table/coreTablesFeature.types.ts:84](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L84) diff --git a/docs/reference/index/type-aliases/ExtractFeatureMapTypes.md b/docs/reference/index/type-aliases/ExtractFeatureMapTypes.md index 70557c8a8c..7914800d23 100644 --- a/docs/reference/index/type-aliases/ExtractFeatureMapTypes.md +++ b/docs/reference/index/type-aliases/ExtractFeatureMapTypes.md @@ -9,7 +9,7 @@ title: ExtractFeatureMapTypes type ExtractFeatureMapTypes = IsAny extends true ? UnionToIntersection : UnionToIntersectionOrEmpty]>; ``` -Defined in: [types/TableFeatures.ts:40](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L40) +Defined in: [types/TableFeatures.ts:43](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L43) Extracts the API/types contributed by the features present in `TFeatures`. diff --git a/docs/reference/index/type-aliases/ExtractTableMeta.md b/docs/reference/index/type-aliases/ExtractTableMeta.md index 1e9467217d..84f7e47859 100644 --- a/docs/reference/index/type-aliases/ExtractTableMeta.md +++ b/docs/reference/index/type-aliases/ExtractTableMeta.md @@ -9,7 +9,7 @@ title: ExtractTableMeta type ExtractTableMeta = IsAny extends true ? TableMeta : TFeatures extends object ? TMeta : TableMeta; ``` -Defined in: [core/table/coreTablesFeature.types.ts:29](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L29) +Defined in: [core/table/coreTablesFeature.types.ts:30](https://github.com/TanStack/table/blob/main/packages/table-core/src/core/table/coreTablesFeature.types.ts#L30) Resolves the type of `options.meta` for a feature set. diff --git a/docs/reference/index/type-aliases/IsAny.md b/docs/reference/index/type-aliases/IsAny.md index b9b8472890..d678b2a712 100644 --- a/docs/reference/index/type-aliases/IsAny.md +++ b/docs/reference/index/type-aliases/IsAny.md @@ -9,7 +9,7 @@ title: IsAny type IsAny = 0 extends 1 & T ? true : false; ``` -Defined in: [types/TableFeatures.ts:21](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L21) +Defined in: [types/TableFeatures.ts:24](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L24) Detects whether a type is `any`. diff --git a/docs/reference/index/type-aliases/NonFeatureKeys.md b/docs/reference/index/type-aliases/NonFeatureKeys.md index 5d21738c74..bb449cf7bb 100644 --- a/docs/reference/index/type-aliases/NonFeatureKeys.md +++ b/docs/reference/index/type-aliases/NonFeatureKeys.md @@ -24,7 +24,7 @@ type NonFeatureKeys = | "tableMeta"; ``` -Defined in: [types/TableFeatures.ts:67](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L67) +Defined in: [types/TableFeatures.ts:70](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L70) Keys of the `features` option that are not table features themselves. diff --git a/docs/reference/index/type-aliases/ValidateFeatureSlots.md b/docs/reference/index/type-aliases/ValidateFeatureSlots.md index d81d981cca..472bee7a19 100644 --- a/docs/reference/index/type-aliases/ValidateFeatureSlots.md +++ b/docs/reference/index/type-aliases/ValidateFeatureSlots.md @@ -9,7 +9,7 @@ title: ValidateFeatureSlots type ValidateFeatureSlots = IsAny extends true ? object : { [K in keyof TFeatures as K extends keyof FeatureSlotPrereqs ? K : never]: K extends keyof FeatureSlotPrereqs ? [Extract] extends [never] ? `Error: '${K & string}' requires '${FeatureSlotPrereqs[K] & string}' to be included in this table's features.` : TFeatures[K] : never }; ``` -Defined in: [types/TableFeatures.ts:158](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L158) +Defined in: [types/TableFeatures.ts:161](https://github.com/TanStack/table/blob/main/packages/table-core/src/types/TableFeatures.ts#L161) Validates that every row model and fn registry slot in a features object is accompanied by its prerequisite feature. diff --git a/docs/reference/index/variables/aggregationFn_count.md b/docs/reference/index/variables/aggregationFn_count.md index 871b9797b6..ffe5518993 100644 --- a/docs/reference/index/variables/aggregationFn_count.md +++ b/docs/reference/index/variables/aggregationFn_count.md @@ -9,6 +9,6 @@ title: aggregationFn_count const aggregationFn_count: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:282](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L282) +Defined in: [features/row-aggregation/aggregationFns.ts:320](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L320) Counts rows, independently of the column's values. diff --git a/docs/reference/index/variables/aggregationFn_extent.md b/docs/reference/index/variables/aggregationFn_extent.md index e0763c9907..a4a5ac40eb 100644 --- a/docs/reference/index/variables/aggregationFn_extent.md +++ b/docs/reference/index/variables/aggregationFn_extent.md @@ -9,7 +9,7 @@ title: aggregationFn_extent const aggregationFn_extent: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:146](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L146) +Defined in: [features/row-aggregation/aggregationFns.ts:162](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L162) Finds the minimum and maximum numeric or Date values from the selected rows. Empty inputs return diff --git a/docs/reference/index/variables/aggregationFn_first.md b/docs/reference/index/variables/aggregationFn_first.md index ff2356dd7e..66db8bc2ca 100644 --- a/docs/reference/index/variables/aggregationFn_first.md +++ b/docs/reference/index/variables/aggregationFn_first.md @@ -9,6 +9,6 @@ title: aggregationFn_first const aggregationFn_first: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:300](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L300) +Defined in: [features/row-aggregation/aggregationFns.ts:338](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L338) Returns the first row's value, including a nullish value. diff --git a/docs/reference/index/variables/aggregationFn_last.md b/docs/reference/index/variables/aggregationFn_last.md index 4dda251314..a6dec5e830 100644 --- a/docs/reference/index/variables/aggregationFn_last.md +++ b/docs/reference/index/variables/aggregationFn_last.md @@ -9,6 +9,6 @@ title: aggregationFn_last const aggregationFn_last: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:312](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L312) +Defined in: [features/row-aggregation/aggregationFns.ts:350](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L350) Returns the last row's value, including a nullish value. diff --git a/docs/reference/index/variables/aggregationFn_max.md b/docs/reference/index/variables/aggregationFn_max.md index c99ef8ec04..14ca7ac698 100644 --- a/docs/reference/index/variables/aggregationFn_max.md +++ b/docs/reference/index/variables/aggregationFn_max.md @@ -9,7 +9,7 @@ title: aggregationFn_max const aggregationFn_max: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:109](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L109) +Defined in: [features/row-aggregation/aggregationFns.ts:112](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L112) Finds the maximum numeric or Date value from the selected rows. Invalid value types are ignored; `NaN` preserves the legacy numeric seeding behavior. diff --git a/docs/reference/index/variables/aggregationFn_mean.md b/docs/reference/index/variables/aggregationFn_mean.md index a64c335ce3..0db4de0060 100644 --- a/docs/reference/index/variables/aggregationFn_mean.md +++ b/docs/reference/index/variables/aggregationFn_mean.md @@ -9,7 +9,7 @@ title: aggregationFn_mean const aggregationFn_mean: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:201](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L201) +Defined in: [features/row-aggregation/aggregationFns.ts:235](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L235) Averages number and number-like row values. Nullish and non-numeric values are ignored; other values retain the legacy unary-plus coercion behavior. diff --git a/docs/reference/index/variables/aggregationFn_median.md b/docs/reference/index/variables/aggregationFn_median.md index b0b1efe1bd..029675e0d4 100644 --- a/docs/reference/index/variables/aggregationFn_median.md +++ b/docs/reference/index/variables/aggregationFn_median.md @@ -9,7 +9,7 @@ title: aggregationFn_median const aggregationFn_median: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:227](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L227) +Defined in: [features/row-aggregation/aggregationFns.ts:262](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L262) Computes the median when every row value is a number. Returns `undefined` for empty inputs or when any value is non-numeric. diff --git a/docs/reference/index/variables/aggregationFn_min.md b/docs/reference/index/variables/aggregationFn_min.md index ec661b7605..cfde98f631 100644 --- a/docs/reference/index/variables/aggregationFn_min.md +++ b/docs/reference/index/variables/aggregationFn_min.md @@ -9,7 +9,7 @@ title: aggregationFn_min const aggregationFn_min: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:73](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L73) +Defined in: [features/row-aggregation/aggregationFns.ts:63](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L63) Finds the minimum numeric or Date value from the selected rows. Invalid value types are ignored; `NaN` preserves the legacy numeric seeding behavior. diff --git a/docs/reference/index/variables/aggregationFn_sum.md b/docs/reference/index/variables/aggregationFn_sum.md index 8661685561..dd2f8b6083 100644 --- a/docs/reference/index/variables/aggregationFn_sum.md +++ b/docs/reference/index/variables/aggregationFn_sum.md @@ -9,7 +9,7 @@ title: aggregationFn_sum const aggregationFn_sum: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:45](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L45) +Defined in: [features/row-aggregation/aggregationFns.ts:34](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L34) Sums numeric selected-row values. Non-number values contribute zero. As in the previous API, `NaN` is a number and therefore propagates through the sum. diff --git a/docs/reference/index/variables/aggregationFn_unique.md b/docs/reference/index/variables/aggregationFn_unique.md index 99c015d042..8d839d4375 100644 --- a/docs/reference/index/variables/aggregationFn_unique.md +++ b/docs/reference/index/variables/aggregationFn_unique.md @@ -9,6 +9,6 @@ title: aggregationFn_unique const aggregationFn_unique: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:250](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L250) +Defined in: [features/row-aggregation/aggregationFns.ts:286](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L286) Collects distinct row values using JavaScript `Set` semantics. diff --git a/docs/reference/index/variables/aggregationFn_uniqueCount.md b/docs/reference/index/variables/aggregationFn_uniqueCount.md index 8a993463c4..ec2185e96a 100644 --- a/docs/reference/index/variables/aggregationFn_uniqueCount.md +++ b/docs/reference/index/variables/aggregationFn_uniqueCount.md @@ -9,6 +9,6 @@ title: aggregationFn_uniqueCount const aggregationFn_uniqueCount: AggregationFnDef; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:266](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L266) +Defined in: [features/row-aggregation/aggregationFns.ts:303](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L303) Counts distinct row values using JavaScript `Set` semantics. diff --git a/docs/reference/index/variables/aggregationFns.md b/docs/reference/index/variables/aggregationFns.md index ed6ceee628..cc2bb426f8 100644 --- a/docs/reference/index/variables/aggregationFns.md +++ b/docs/reference/index/variables/aggregationFns.md @@ -9,7 +9,7 @@ title: aggregationFns const aggregationFns: object; ``` -Defined in: [features/row-aggregation/aggregationFns.ts:331](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L331) +Defined in: [features/row-aggregation/aggregationFns.ts:369](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/aggregationFns.ts#L369) Full built-in registry. Register individual definitions for tree-shaking. diff --git a/docs/reference/static-functions/functions/aggregateColumnValue.md b/docs/reference/static-functions/functions/aggregateColumnValue.md index 53b17407e4..37f7a9d85b 100644 --- a/docs/reference/static-functions/functions/aggregateColumnValue.md +++ b/docs/reference/static-functions/functions/aggregateColumnValue.md @@ -9,7 +9,7 @@ title: aggregateColumnValue function aggregateColumnValue(args): unknown; ``` -Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:261](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L261) +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:307](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L307) Executes every configured aggregation over a depth-selected row frontier. @@ -47,6 +47,14 @@ readonly [`Row`](../../index/type-aliases/Row.md)\<`TFeatures`, `TData`\>[] readonly [`Row`](../../index/type-aliases/Row.md)\<`TFeatures`, `TData`\>[] +#### uniqueRows? + +`boolean` + +Marks `rows` as distinct nodes of a single row tree (rows the table's own +row models produced), enabling frontier selection without the +duplicate-id guard. Caller-supplied row arrays must omit this. + ## Returns `unknown` diff --git a/docs/reference/static-functions/functions/cell_getIsAggregated.md b/docs/reference/static-functions/functions/cell_getIsAggregated.md index fe8c464dde..11f960b9cb 100644 --- a/docs/reference/static-functions/functions/cell_getIsAggregated.md +++ b/docs/reference/static-functions/functions/cell_getIsAggregated.md @@ -9,7 +9,7 @@ title: cell_getIsAggregated function cell_getIsAggregated(cell): boolean; ``` -Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:393](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L393) +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:450](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L450) Implements `cell.getIsAggregated()` for synthetic grouped rows. diff --git a/docs/reference/static-functions/functions/column_getAggregationFns.md b/docs/reference/static-functions/functions/column_getAggregationFns.md index 6e46a9e703..2974ca4a65 100644 --- a/docs/reference/static-functions/functions/column_getAggregationFns.md +++ b/docs/reference/static-functions/functions/column_getAggregationFns.md @@ -9,7 +9,7 @@ title: column_getAggregationFns function column_getAggregationFns(column): readonly ResolvedAggregationFn[]; ``` -Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:155](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L155) +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:201](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L201) Resolves and validates a column's scalar or multiple aggregation option. diff --git a/docs/reference/static-functions/functions/column_getAggregationValue.md b/docs/reference/static-functions/functions/column_getAggregationValue.md index 17ef1824ad..1121ccef2f 100644 --- a/docs/reference/static-functions/functions/column_getAggregationValue.md +++ b/docs/reference/static-functions/functions/column_getAggregationValue.md @@ -9,7 +9,7 @@ title: column_getAggregationValue function column_getAggregationValue(column, options?): ColumnAggregationValue; ``` -Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:330](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L330) +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:386](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L386) Implements `column.getAggregationValue(options?)` and its default cache. diff --git a/docs/reference/static-functions/functions/column_getAutoAggregationFn.md b/docs/reference/static-functions/functions/column_getAutoAggregationFn.md index 3f8ecf3189..ffd34f4af4 100644 --- a/docs/reference/static-functions/functions/column_getAutoAggregationFn.md +++ b/docs/reference/static-functions/functions/column_getAutoAggregationFn.md @@ -11,7 +11,7 @@ function column_getAutoAggregationFn(column): | undefined; ``` -Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:113](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L113) +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:159](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L159) Resolves the `sum` or `extent` definition inferred from the first core row. diff --git a/docs/reference/static-functions/functions/formatAggregatedCellValue.md b/docs/reference/static-functions/functions/formatAggregatedCellValue.md index bdc2fea8f3..2cfa6f6b1d 100644 --- a/docs/reference/static-functions/functions/formatAggregatedCellValue.md +++ b/docs/reference/static-functions/functions/formatAggregatedCellValue.md @@ -9,7 +9,7 @@ title: formatAggregatedCellValue function formatAggregatedCellValue(value, option): string | null; ``` -Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:414](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L414) +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:471](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L471) Formats the default scalar or keyed aggregated-cell representation. diff --git a/docs/reference/static-functions/functions/isRowSelected.md b/docs/reference/static-functions/functions/isRowSelected.md index 8c02ea47e0..1139c47068 100644 --- a/docs/reference/static-functions/functions/isRowSelected.md +++ b/docs/reference/static-functions/functions/isRowSelected.md @@ -9,7 +9,7 @@ title: isRowSelected function isRowSelected(row, rowSelection): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:868](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L868) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:869](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L869) Returns whether a row id is selected in the current row selection state. diff --git a/docs/reference/static-functions/functions/isSubRowSelected.md b/docs/reference/static-functions/functions/isSubRowSelected.md index 91a6d0ec3e..7f76cf0efb 100644 --- a/docs/reference/static-functions/functions/isSubRowSelected.md +++ b/docs/reference/static-functions/functions/isSubRowSelected.md @@ -9,7 +9,7 @@ title: isSubRowSelected function isSubRowSelected(row): boolean | "some" | "all"; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:885](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L885) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:886](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L886) Returns whether all, some, or none of a row's selectable descendants are selected. diff --git a/docs/reference/static-functions/functions/normalizeUniqueAggregationRows.md b/docs/reference/static-functions/functions/normalizeUniqueAggregationRows.md new file mode 100644 index 0000000000..572a573135 --- /dev/null +++ b/docs/reference/static-functions/functions/normalizeUniqueAggregationRows.md @@ -0,0 +1,42 @@ +--- +id: normalizeUniqueAggregationRows +title: normalizeUniqueAggregationRows +--- + +# Function: normalizeUniqueAggregationRows() + +```ts +function normalizeUniqueAggregationRows(rows, maxDepth): readonly Row[]; +``` + +Defined in: [features/row-aggregation/rowAggregationFeature.utils.ts:105](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-aggregation/rowAggregationFeature.utils.ts#L105) + +Frontier selection for rows that are distinct nodes of a single row tree — +the row models the table builds itself. Skips `normalizeAggregationRows`' +duplicate-id guard (disjoint subtrees cannot revisit a row) and returns +`rows` unchanged when no row descends, so the default `maxDepth: 0` case +costs nothing per aggregation. + +## Type Parameters + +### TFeatures + +`TFeatures` *extends* [`TableFeatures`](../../index/interfaces/TableFeatures.md) + +### TData + +`TData` *extends* [`RowData`](../../index/type-aliases/RowData.md) + +## Parameters + +### rows + +readonly [`Row`](../../index/type-aliases/Row.md)\<`TFeatures`, `TData`\>[] + +### maxDepth + +`number` = `0` + +## Returns + +readonly [`Row`](../../index/type-aliases/Row.md)\<`TFeatures`, `TData`\>[] diff --git a/docs/reference/static-functions/functions/row_getCanMultiSelect.md b/docs/reference/static-functions/functions/row_getCanMultiSelect.md index 882c89ee0c..9a063c0da0 100644 --- a/docs/reference/static-functions/functions/row_getCanMultiSelect.md +++ b/docs/reference/static-functions/functions/row_getCanMultiSelect.md @@ -9,7 +9,7 @@ title: row_getCanMultiSelect function row_getCanMultiSelect(row): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:633](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L633) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:634](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L634) Checks whether this row can be selected alongside other rows. diff --git a/docs/reference/static-functions/functions/row_getCanSelect.md b/docs/reference/static-functions/functions/row_getCanSelect.md index 8fdedba827..569ab7a2c4 100644 --- a/docs/reference/static-functions/functions/row_getCanSelect.md +++ b/docs/reference/static-functions/functions/row_getCanSelect.md @@ -9,7 +9,7 @@ title: row_getCanSelect function row_getCanSelect(row): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:587](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L587) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:588](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L588) Checks whether this row can be selected. diff --git a/docs/reference/static-functions/functions/row_getCanSelectSubRows.md b/docs/reference/static-functions/functions/row_getCanSelectSubRows.md index f7f6c43b08..45a929e4f7 100644 --- a/docs/reference/static-functions/functions/row_getCanSelectSubRows.md +++ b/docs/reference/static-functions/functions/row_getCanSelectSubRows.md @@ -9,7 +9,7 @@ title: row_getCanSelectSubRows function row_getCanSelectSubRows(row): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:610](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L610) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:611](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L611) Checks whether selecting this row should also select its subRows. diff --git a/docs/reference/static-functions/functions/row_getIsAllSubRowsSelected.md b/docs/reference/static-functions/functions/row_getIsAllSubRowsSelected.md index f2ca7bb73e..99bbc94068 100644 --- a/docs/reference/static-functions/functions/row_getIsAllSubRowsSelected.md +++ b/docs/reference/static-functions/functions/row_getIsAllSubRowsSelected.md @@ -9,7 +9,7 @@ title: row_getIsAllSubRowsSelected function row_getIsAllSubRowsSelected(row): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:569](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L569) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:570](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L570) Checks whether all selectable descendants are selected. diff --git a/docs/reference/static-functions/functions/row_getIsSelected.md b/docs/reference/static-functions/functions/row_getIsSelected.md index 6fc16bc9fa..a829e0869c 100644 --- a/docs/reference/static-functions/functions/row_getIsSelected.md +++ b/docs/reference/static-functions/functions/row_getIsSelected.md @@ -9,7 +9,7 @@ title: row_getIsSelected function row_getIsSelected(row): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:534](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L534) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:535](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L535) Checks whether this row id is selected in `state.rowSelection`. diff --git a/docs/reference/static-functions/functions/row_getIsSomeSelected.md b/docs/reference/static-functions/functions/row_getIsSomeSelected.md index 7a55c6da32..fa1a80d408 100644 --- a/docs/reference/static-functions/functions/row_getIsSomeSelected.md +++ b/docs/reference/static-functions/functions/row_getIsSomeSelected.md @@ -9,7 +9,7 @@ title: row_getIsSomeSelected function row_getIsSomeSelected(row): boolean; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:552](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L552) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:553](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L553) Checks whether some, but not all, selectable descendants are selected. diff --git a/docs/reference/static-functions/functions/row_getToggleSelectedHandler.md b/docs/reference/static-functions/functions/row_getToggleSelectedHandler.md index 3edbafe674..083c118599 100644 --- a/docs/reference/static-functions/functions/row_getToggleSelectedHandler.md +++ b/docs/reference/static-functions/functions/row_getToggleSelectedHandler.md @@ -9,7 +9,7 @@ title: row_getToggleSelectedHandler function row_getToggleSelectedHandler(row, opts?): (e) => void; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:660](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L660) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:661](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L661) Creates a checkbox-style handler that selects or deselects this row. diff --git a/docs/reference/static-functions/functions/row_toggleSelected.md b/docs/reference/static-functions/functions/row_toggleSelected.md index a507b6d89f..b971b2c05d 100644 --- a/docs/reference/static-functions/functions/row_toggleSelected.md +++ b/docs/reference/static-functions/functions/row_toggleSelected.md @@ -12,12 +12,13 @@ function row_toggleSelected( opts?): void; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:501](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L501) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:502](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L502) Selects or deselects this row. Omitting `value` toggles the row. Child rows are selected recursively unless -`opts.selectChildren` is `false` or sub-row selection is disabled. +`opts.selectChildren` is `false`, sub-row selection is disabled, or the row +only supports single selection. ## Type Parameters diff --git a/docs/reference/static-functions/functions/selectRowsFn.md b/docs/reference/static-functions/functions/selectRowsFn.md index 37f5847434..3985c846f5 100644 --- a/docs/reference/static-functions/functions/selectRowsFn.md +++ b/docs/reference/static-functions/functions/selectRowsFn.md @@ -9,7 +9,7 @@ title: selectRowsFn function selectRowsFn(rowModel, table): RowModel; ``` -Defined in: [features/row-selection/rowSelectionFeature.utils.ts:809](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L809) +Defined in: [features/row-selection/rowSelectionFeature.utils.ts:810](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-selection/rowSelectionFeature.utils.ts#L810) Builds a row model containing rows selected by the current row selection state. diff --git a/docs/reference/static-functions/index.md b/docs/reference/static-functions/index.md index 834e880057..1f4da5647c 100644 --- a/docs/reference/static-functions/index.md +++ b/docs/reference/static-functions/index.md @@ -87,6 +87,7 @@ title: static-functions - [isSubRowSelected](functions/isSubRowSelected.md) - [isTouchStartEvent](functions/isTouchStartEvent.md) - [normalizeAggregationRows](functions/normalizeAggregationRows.md) +- [normalizeUniqueAggregationRows](functions/normalizeUniqueAggregationRows.md) - [orderColumns](functions/orderColumns.md) - [passiveEventSupported](functions/passiveEventSupported.md) - [row\_getAllCells](functions/row_getAllCells.md) diff --git a/packages/table-core/src/core/cells/constructCell.ts b/packages/table-core/src/core/cells/constructCell.ts index 2d23506026..65c393c938 100644 --- a/packages/table-core/src/core/cells/constructCell.ts +++ b/packages/table-core/src/core/cells/constructCell.ts @@ -51,5 +51,11 @@ export function constructCell< cell.id = `${row.id}_${column.id}` cell.row = row + // Initialize instance-specific data for features that need it + const initFns = table._cellInstanceInitFns! + for (let i = 0; i < initFns.length; i++) { + initFns[i]!(cell as Cell) + } + return cell as Cell } diff --git a/packages/table-core/src/core/columns/constructColumn.ts b/packages/table-core/src/core/columns/constructColumn.ts index 35815746da..e3eb5bfcb8 100644 --- a/packages/table-core/src/core/columns/constructColumn.ts +++ b/packages/table-core/src/core/columns/constructColumn.ts @@ -1,4 +1,3 @@ -import {} from '../../utils' import type { Table_Internal } from '../../types/Table' import type { CellData, RowData } from '../../types/type-utils' import type { TableFeatures } from '../../types/TableFeatures' @@ -118,9 +117,9 @@ export function constructColumn< column.parent = parent // Initialize instance-specific data for features that need it - const features = Object.values(table._features) - for (let i = 0; i < features.length; i++) { - features[i]!.initColumnInstanceData?.(column) + const initFns = table._columnInstanceInitFns! + for (let i = 0; i < initFns.length; i++) { + initFns[i]!(column as Column) } return column as Column diff --git a/packages/table-core/src/core/headers/buildHeaderGroups.ts b/packages/table-core/src/core/headers/buildHeaderGroups.ts index 8958997902..ff3391913a 100644 --- a/packages/table-core/src/core/headers/buildHeaderGroups.ts +++ b/packages/table-core/src/core/headers/buildHeaderGroups.ts @@ -51,6 +51,8 @@ export function buildHeaderGroups< const headerGroups: Array> = [] + const headerGroupInitFns = table._headerGroupInstanceInitFns! + const constructHeaderGroup = ( headersToGroup: Array>, depth: number, @@ -119,6 +121,11 @@ export function buildHeaderGroups< headerToGroup.headerGroup = headerGroup }) + // Initialize instance-specific data for features that need it + for (let i = 0; i < headerGroupInitFns.length; i++) { + headerGroupInitFns[i]!(headerGroup) + } + headerGroups.push(headerGroup) if (depth > 0) { diff --git a/packages/table-core/src/core/headers/constructHeader.ts b/packages/table-core/src/core/headers/constructHeader.ts index 7e52343dfd..6cb5b2b4b3 100644 --- a/packages/table-core/src/core/headers/constructHeader.ts +++ b/packages/table-core/src/core/headers/constructHeader.ts @@ -63,5 +63,11 @@ export function constructHeader< header.rowSpan = 0 header.subHeaders = [] + // Initialize instance-specific data for features that need it + const initFns = table._headerInstanceInitFns! + for (let i = 0; i < initFns.length; i++) { + initFns[i]!(header as Header) + } + return header as Header } diff --git a/packages/table-core/src/core/table/constructTable.ts b/packages/table-core/src/core/table/constructTable.ts index 2d706c8234..64a29c75ec 100644 --- a/packages/table-core/src/core/table/constructTable.ts +++ b/packages/table-core/src/core/table/constructTable.ts @@ -68,16 +68,6 @@ export function constructTable< const featuresList: Array = Object.values(table._features) - const rowInstanceInitFns: Array< - NonNullable - > = [] - for (const feature of featuresList) { - if (feature.initRowInstanceData) { - rowInstanceInitFns.push(feature.initRowInstanceData.bind(feature)) - } - } - table._rowInstanceInitFns = rowInstanceInitFns - const defaultOptions = featuresList.reduce((obj, feature) => { return Object.assign(obj, feature.getDefaultTableOptions?.(table)) }, {}) as TableOptions @@ -176,10 +166,51 @@ export function constructTable< ), ) + // pre-compute the init functions to make the other constructors faster + const cellInstanceInitFns: Array< + NonNullable + > = [] + const columnInstanceInitFns: Array< + NonNullable + > = [] + const headerGroupInstanceInitFns: Array< + NonNullable + > = [] + const headerInstanceInitFns: Array< + NonNullable + > = [] + const rowInstanceInitFns: Array< + NonNullable + > = [] + for (let i = 0; i < featuresList.length; i++) { - featuresList[i]!.initTableInstanceData?.(table) + const feature = featuresList[i]! + if (feature.initCellInstanceData) { + cellInstanceInitFns.push(feature.initCellInstanceData.bind(feature)) + } + if (feature.initColumnInstanceData) { + columnInstanceInitFns.push(feature.initColumnInstanceData.bind(feature)) + } + if (feature.initHeaderGroupInstanceData) { + headerGroupInstanceInitFns.push( + feature.initHeaderGroupInstanceData.bind(feature), + ) + } + if (feature.initHeaderInstanceData) { + headerInstanceInitFns.push(feature.initHeaderInstanceData.bind(feature)) + } + if (feature.initRowInstanceData) { + rowInstanceInitFns.push(feature.initRowInstanceData.bind(feature)) + } + feature.initTableInstanceData?.(table) } + table._cellInstanceInitFns = cellInstanceInitFns + table._columnInstanceInitFns = columnInstanceInitFns + table._headerGroupInstanceInitFns = headerGroupInstanceInitFns + table._headerInstanceInitFns = headerInstanceInitFns + table._rowInstanceInitFns = rowInstanceInitFns + if ( process.env.NODE_ENV === 'development' && (tableOptions.debugAll || tableOptions.debugTable) diff --git a/packages/table-core/src/core/table/coreTablesFeature.types.ts b/packages/table-core/src/core/table/coreTablesFeature.types.ts index 80afe099e7..7dfaf87e80 100644 --- a/packages/table-core/src/core/table/coreTablesFeature.types.ts +++ b/packages/table-core/src/core/table/coreTablesFeature.types.ts @@ -161,10 +161,22 @@ export interface Table_CoreProperties< * Table reactivity bindings for interacting with TanStack Store. */ readonly _reactivity: TableReactivityBindings + /** + * Cache of the `initCellInstanceData` functions for features that define one. + */ + _cellInstanceInitFns?: Array< + NonNullable + > /** * Prototype cache for Cell objects - shared by all cells in this table */ _cellPrototype?: object + /** + * Cache of the `initColumnInstanceData` functions for features that define one. + */ + _columnInstanceInitFns?: Array< + NonNullable + > /** * Prototype cache for Column objects - shared by all columns in this table */ @@ -173,6 +185,18 @@ export interface Table_CoreProperties< * The features that are enabled for the table. */ readonly _features: Partial & TFeatures + /** + * Cache of the `initHeaderGroupInstanceData` functions for features that define one. + */ + _headerGroupInstanceInitFns?: Array< + NonNullable + > + /** + * Cache of the `initHeaderInstanceData` functions for features that define one. + */ + _headerInstanceInitFns?: Array< + NonNullable + > /** * Prototype cache for Header objects - shared by all headers in this table */ diff --git a/packages/table-core/src/types/TableFeatures.ts b/packages/table-core/src/types/TableFeatures.ts index 56b063d509..10fe36c252 100644 --- a/packages/table-core/src/types/TableFeatures.ts +++ b/packages/table-core/src/types/TableFeatures.ts @@ -1,7 +1,10 @@ import type { CoreFeatures } from '../core/coreFeatures' import type { CellData, RowData, UnionToIntersection } from './type-utils' +import type { Cell } from './Cell' import type { Column } from './Column' import type { ColumnDefBase_All } from './ColumnDef' +import type { Header } from './Header' +import type { HeaderGroup } from './HeaderGroup' import type { Row } from './Row' import type { Table_Internal } from './Table' import type { TableOptions_All } from './TableOptions' @@ -310,8 +313,8 @@ export interface TableFeatures * * Feature objects are registered in the table's `features` option. They can * contribute default state/options, default column definitions, table APIs, - * shared prototype APIs for rows/columns/headers/cells, and per-instance row - * or column data. + * shared prototype APIs for rows/columns/headers/cells, and per-instance data + * for tables, columns, rows, headers, header groups, and cells. */ export interface TableFeature { /** @@ -434,6 +437,22 @@ export interface TableFeature { >( table: Table_Internal, ) => void + /** + * Initializes instance-specific data on each cell. + * + * This runs for every constructed cell after core cell fields such as `id`, + * `column`, and `row` have been assigned. Cells are constructed lazily on + * first access per row/column pair and cached, so this runs once per cell + * instance. Use this for per-cell mutable data, caches, or annotations. + * Shared methods should be assigned via `assignCellPrototype` instead. + */ + initCellInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + cell: Cell, + ) => void /** * Initializes instance-specific data on each column. * @@ -449,6 +468,39 @@ export interface TableFeature { >( column: Column, ) => void + /** + * Initializes instance-specific data on each header group. + * + * This runs for every constructed header group after `depth`, `id`, and the + * fully populated `headers` array have been assigned. Header groups have no + * shared prototype, so this is their only per-instance extension point. + * Header groups are reconstructed whenever they recompute (e.g. column + * visibility, order, or pinning changes), so this reruns on every rebuild. + */ + initHeaderGroupInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + >( + headerGroup: HeaderGroup, + ) => void + /** + * Initializes instance-specific data on each header. + * + * This runs for every constructed header after core header fields such as + * `id`, `column`, `depth`, `index`, and `isPlaceholder` have been assigned, + * but before `subHeaders` are populated and before `headerGroup` is linked. + * Headers are reconstructed on every header group rebuild, so this reruns + * on every rebuild. Use this for per-header mutable data, caches, or + * annotations. Shared methods should be assigned via `assignHeaderPrototype` + * instead. + */ + initHeaderInstanceData?: < + TFeatures extends TableFeatures, + TData extends RowData, + TValue extends CellData = CellData, + >( + header: Header, + ) => void /** * Initializes instance-specific data on each row. * diff --git a/packages/table-core/tests/unit/core/cells/constructCell.test.ts b/packages/table-core/tests/unit/core/cells/constructCell.test.ts index a7cfefbe22..a83afc38a7 100644 --- a/packages/table-core/tests/unit/core/cells/constructCell.test.ts +++ b/packages/table-core/tests/unit/core/cells/constructCell.test.ts @@ -3,6 +3,7 @@ import { constructTable } from '../../../../src' import { constructCell } from '../../../../src/core/cells/constructCell' import { testFeatures } from '../../../fixtures/features' import type { ColumnDef } from '../../../../src/types/ColumnDef' +import type { TableFeature } from '../../../../src/types/TableFeatures' interface Person { firstName: string @@ -38,4 +39,47 @@ describe('constructCell', () => { expect(coreCell.column).toBe(column) expect(coreCell.row).toBe(row) }) + + it('should initialize instance-specific cell data once per cell', () => { + let initCount = 0 + const annotationFeature: TableFeature = { + initCellInstanceData: (cell) => { + Object.defineProperty(cell, 'instanceAnnotation', { + value: `${cell.row.id}_${cell.column.id}`, + enumerable: true, + configurable: true, + }) + initCount++ + }, + } + const featuresWithAnnotations = { + ...features, + annotationFeature, + } + + const table = constructTable({ + features: featuresWithAnnotations, + columns: columns as any, + data: [{ firstName: 'Tanner' }, { firstName: 'Kevin' }], + }) + + const rows = table.getRowModel().rows + const firstCells = rows.flatMap((row) => row.getAllCells()) + + expect(firstCells.length).toBe(2) + for (const cell of firstCells) { + expect( + Object.prototype.hasOwnProperty.call(cell, 'instanceAnnotation'), + ).toBe(true) + expect((cell as any).instanceAnnotation).toBe( + `${cell.row.id}_${cell.column.id}`, + ) + } + expect(initCount).toBe(2) + + // Cells are cached per row/column pair, so re-access constructs no new cells + const secondCells = rows.flatMap((row) => row.getAllCells()) + expect(secondCells[0]).toBe(firstCells[0]) + expect(initCount).toBe(2) + }) }) diff --git a/packages/table-core/tests/unit/core/headers/constructHeader.test.ts b/packages/table-core/tests/unit/core/headers/constructHeader.test.ts index 792d135cde..cd44c3220d 100644 --- a/packages/table-core/tests/unit/core/headers/constructHeader.test.ts +++ b/packages/table-core/tests/unit/core/headers/constructHeader.test.ts @@ -3,6 +3,7 @@ import { constructTable } from '../../../../src' import { constructHeader } from '../../../../src/core/headers/constructHeader' import { testFeatures } from '../../../fixtures/features' import type { ColumnDef } from '../../../../src/types/ColumnDef' +import type { TableFeature } from '../../../../src/types/TableFeatures' interface Person { firstName: string @@ -46,4 +47,119 @@ describe('constructHeader', () => { expect(header.id).toBe(column.id) }) + + it('should initialize instance-specific header data for every header', () => { + const initializedHeaders: Array<{ + id: string + isPlaceholder: boolean + subHeadersLengthAtInit: number + }> = [] + const annotationFeature: TableFeature = { + initHeaderInstanceData: (header) => { + Object.defineProperty(header, 'instanceAnnotation', { + value: header.id, + enumerable: true, + configurable: true, + }) + initializedHeaders.push({ + id: header.id, + isPlaceholder: header.isPlaceholder, + subHeadersLengthAtInit: header.subHeaders.length, + }) + }, + } + const featuresWithAnnotations = { + ...features, + annotationFeature, + } + const groupedColumns: Array< + ColumnDef + > = [ + { + id: 'group', + header: 'Group', + columns: [{ id: 'child', accessorKey: 'firstName' }], + }, + { id: 'solo', accessorKey: 'firstName' }, + ] + + const table = constructTable({ + features: featuresWithAnnotations, + columns: groupedColumns, + data: [], + }) + + const allHeaders = table + .getHeaderGroups() + .flatMap((headerGroup) => headerGroup.headers) + + expect(allHeaders.length).toBeGreaterThan(0) + for (const header of allHeaders) { + expect( + Object.prototype.hasOwnProperty.call(header, 'instanceAnnotation'), + ).toBe(true) + expect((header as any).instanceAnnotation).toBe(header.id) + } + + // Placeholder headers run the hook too + expect( + initializedHeaders.some((initialized) => initialized.isPlaceholder), + ).toBe(true) + // The hook runs during construction, before subHeaders are populated + for (const initialized of initializedHeaders) { + expect(initialized.subHeadersLengthAtInit).toBe(0) + } + }) + + it('should initialize instance-specific header group data for every header group', () => { + const initializedGroups: Array<{ + id: string + headersCount: number + backRefsLinked: boolean + }> = [] + const annotationFeature: TableFeature = { + initHeaderGroupInstanceData: (headerGroup) => { + initializedGroups.push({ + id: headerGroup.id, + headersCount: headerGroup.headers.length, + backRefsLinked: headerGroup.headers.every( + (header) => header.headerGroup === headerGroup, + ), + }) + }, + } + const featuresWithAnnotations = { + ...features, + annotationFeature, + } + const groupedColumns: Array< + ColumnDef + > = [ + { + id: 'group', + header: 'Group', + columns: [{ id: 'child', accessorKey: 'firstName' }], + }, + ] + + const table = constructTable({ + features: featuresWithAnnotations, + columns: groupedColumns, + data: [], + }) + + const headerGroups = table.getHeaderGroups() + + // The hook runs once per group, after its headers are fully populated + expect(headerGroups.length).toBe(2) + expect(initializedGroups.length).toBe(headerGroups.length) + for (const initialized of initializedGroups) { + expect(initialized.headersCount).toBeGreaterThan(0) + expect(initialized.backRefsLinked).toBe(true) + } + + // Memoized header groups do not rebuild, so the hook does not rerun + table.getHeaderGroups() + expect(initializedGroups.length).toBe(headerGroups.length) + }) }) diff --git a/packages/table-core/tests/unit/core/table/constructTable.test.ts b/packages/table-core/tests/unit/core/table/constructTable.test.ts index 80fff54313..adecafbfe1 100644 --- a/packages/table-core/tests/unit/core/table/constructTable.test.ts +++ b/packages/table-core/tests/unit/core/table/constructTable.test.ts @@ -105,6 +105,59 @@ describe('constructTable', () => { expect(table.apiWithoutInit).toBe(true) }) + it('pre-computes per-instance init functions bound to their feature', () => { + const initialized = new Set() + // Method shorthand so each hook reads `this` from the feature object, + // proving the cached init fns are bound to their feature + const bindingFeature = { + marker: 'bound-feature', + initCellInstanceData(this: any) { + initialized.add(`cell:${this.marker}`) + }, + initColumnInstanceData(this: any) { + initialized.add(`column:${this.marker}`) + }, + initHeaderGroupInstanceData(this: any) { + initialized.add(`headerGroup:${this.marker}`) + }, + initHeaderInstanceData(this: any) { + initialized.add(`header:${this.marker}`) + }, + initRowInstanceData(this: any) { + initialized.add(`row:${this.marker}`) + }, + } as TableFeature + const features = { + ...testFeatures({}), + bindingFeature, + } as any + + const table = constructTable({ + features, + columns: [{ id: 'first-name', accessorKey: 'firstName' }], + data: [{ firstName: 'Tanner' }], + } as any) as any + + expect(table._cellInstanceInitFns).toHaveLength(1) + expect(table._columnInstanceInitFns).toHaveLength(1) + expect(table._headerGroupInstanceInitFns).toHaveLength(1) + expect(table._headerInstanceInitFns).toHaveLength(1) + expect(table._rowInstanceInitFns).toHaveLength(1) + + table.getHeaderGroups() + table.getRowModel().rows.forEach((row: any) => row.getAllCells()) + + expect(initialized).toEqual( + new Set([ + 'cell:bound-feature', + 'column:bound-feature', + 'headerGroup:bound-feature', + 'header:bound-feature', + 'row:bound-feature', + ]), + ) + }) + it('resets feature-owned table data after internal atoms without rerunning initialization', () => { const init = vi.fn((table: any) => { table.transientValue = 'initialized'