@tanstack/table-core 9.0.0-beta.37 → 9.0.0-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.d.cts +1 -1
- package/dist/core/headers/buildHeaderGroups.d.ts +1 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs +7 -7
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.js +7 -7
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.cjs +1 -1
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.js +1 -1
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +5 -5
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +5 -5
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +6 -6
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +3 -3
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +3 -3
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +6 -6
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.cjs +44 -39
- package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.d.cts +6 -1
- package/dist/features/column-pinning/columnPinningFeature.d.ts +6 -1
- package/dist/features/column-pinning/columnPinningFeature.js +45 -40
- package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +49 -38
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +49 -38
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +154 -146
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +81 -73
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +81 -73
- package/dist/features/column-pinning/columnPinningFeature.utils.js +141 -133
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.cjs +4 -4
- package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.js +5 -5
- package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.types.d.cts +18 -12
- package/dist/features/column-sizing/columnSizingFeature.types.d.ts +18 -12
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +24 -20
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +18 -14
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +18 -14
- package/dist/features/column-sizing/columnSizingFeature.utils.js +24 -20
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +16 -16
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +3 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +3 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +16 -16
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/static-functions.cjs +16 -16
- package/dist/static-functions.d.cts +3 -3
- package/dist/static-functions.d.ts +3 -3
- package/dist/static-functions.js +3 -3
- package/package.json +1 -1
- package/skills/api-not-found/SKILL.md +113 -0
- package/skills/client-vs-server/SKILL.md +164 -0
- package/skills/column-faceting/SKILL.md +91 -0
- package/skills/column-filtering/SKILL.md +82 -0
- package/skills/column-ordering/SKILL.md +75 -0
- package/skills/column-pinning/SKILL.md +89 -0
- package/skills/column-resizing/SKILL.md +91 -0
- package/skills/column-sizing/SKILL.md +72 -0
- package/skills/column-visibility/SKILL.md +75 -0
- package/skills/core/SKILL.md +140 -0
- package/skills/custom-features/SKILL.md +207 -0
- package/skills/expanding/SKILL.md +80 -0
- package/skills/global-filtering/SKILL.md +84 -0
- package/skills/grouping/SKILL.md +50 -394
- package/skills/migrate-v8-to-v9/SKILL.md +230 -390
- package/skills/pagination/SKILL.md +35 -344
- package/skills/row-pinning/SKILL.md +47 -238
- package/skills/row-selection/SKILL.md +39 -351
- package/skills/sorting/SKILL.md +35 -299
- package/skills/table-features/SKILL.md +153 -0
- package/skills/typescript/SKILL.md +126 -0
- package/src/core/headers/buildHeaderGroups.ts +1 -1
- package/src/core/headers/coreHeadersFeature.utils.ts +7 -7
- package/src/core/table/coreTablesFeature.utils.ts +1 -1
- package/src/features/column-ordering/columnOrderingFeature.types.ts +5 -5
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +9 -9
- package/src/features/column-pinning/columnPinningFeature.ts +64 -59
- package/src/features/column-pinning/columnPinningFeature.types.ts +49 -38
- package/src/features/column-pinning/columnPinningFeature.utils.ts +163 -155
- package/src/features/column-sizing/columnSizingFeature.ts +6 -6
- package/src/features/column-sizing/columnSizingFeature.types.ts +18 -12
- package/src/features/column-sizing/columnSizingFeature.utils.ts +31 -27
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +15 -15
- package/skills/column-definitions/SKILL.md +0 -330
- package/skills/column-layout/SKILL.md +0 -326
- package/skills/column-layout/references/subsystems.md +0 -220
- package/skills/customizing-feature-behavior/SKILL.md +0 -423
- package/skills/filtering/SKILL.md +0 -375
- package/skills/filtering/references/faceting-and-fuzzy.md +0 -218
- package/skills/row-expanding/SKILL.md +0 -356
- package/skills/setup/SKILL.md +0 -390
- package/skills/state-management/SKILL.md +0 -403
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-faceting
|
|
3
|
+
description: >
|
|
4
|
+
Build faceted filter UIs with columnFacetingFeature, facetedRowModel, facetedUniqueValues, and facetedMinMaxValues. Load for facet counts, numeric ranges, own-filter exclusion, or server-page facet completeness.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features', 'column-filtering']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-faceting.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-faceting'
|
|
15
|
+
- 'TanStack/table:examples/react/filters-faceted'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core`, `table-features`, and `column-filtering`. Faceting derives filter choices; it does not render controls.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
columnFacetingFeature,
|
|
25
|
+
columnFilteringFeature,
|
|
26
|
+
createFacetedMinMaxValues,
|
|
27
|
+
createFacetedRowModel,
|
|
28
|
+
createFacetedUniqueValues,
|
|
29
|
+
createFilteredRowModel,
|
|
30
|
+
filterFns,
|
|
31
|
+
tableFeatures,
|
|
32
|
+
} from '@tanstack/table-core'
|
|
33
|
+
|
|
34
|
+
export const features = tableFeatures({
|
|
35
|
+
columnFilteringFeature,
|
|
36
|
+
filteredRowModel: createFilteredRowModel(),
|
|
37
|
+
filterFns,
|
|
38
|
+
columnFacetingFeature,
|
|
39
|
+
facetedRowModel: createFacetedRowModel(),
|
|
40
|
+
facetedUniqueValues: createFacetedUniqueValues(),
|
|
41
|
+
facetedMinMaxValues: createFacetedMinMaxValues(),
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Core Patterns
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const counts = table.getColumn('status')?.getFacetedUniqueValues() ?? new Map()
|
|
49
|
+
const range = table.getColumn('age')?.getFacetedMinMaxValues()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use unique values for discrete controls and min/max only for numeric ranges.
|
|
53
|
+
The filtered model makes facets respond to the table's other active filters.
|
|
54
|
+
The built-in `filterFns` registry supports named stock filters; a column may
|
|
55
|
+
instead receive a filter function directly without registering it.
|
|
56
|
+
|
|
57
|
+
## Common Mistakes
|
|
58
|
+
|
|
59
|
+
### [HIGH] Registering APIs without model slots
|
|
60
|
+
|
|
61
|
+
Wrong: `tableFeatures({ columnFilteringFeature, columnFacetingFeature })`
|
|
62
|
+
|
|
63
|
+
Correct: `tableFeatures({ columnFilteringFeature, columnFacetingFeature, facetedRowModel: createFacetedRowModel(), facetedUniqueValues: createFacetedUniqueValues() })`
|
|
64
|
+
|
|
65
|
+
Each faceting getter needs its matching factory slot.
|
|
66
|
+
|
|
67
|
+
Source: `packages/table-core/src/features/column-faceting/columnFacetingFeature.ts`
|
|
68
|
+
|
|
69
|
+
### [MEDIUM] Expecting facet to apply itself
|
|
70
|
+
|
|
71
|
+
Wrong: `column.getFacetedUniqueValues().get(activeValue) === 0`
|
|
72
|
+
|
|
73
|
+
Correct: `column.getFacetedUniqueValues().get(activeValue) ?? 0`
|
|
74
|
+
|
|
75
|
+
A column facet intentionally excludes that column's own filter while applying other filters.
|
|
76
|
+
|
|
77
|
+
Source: `docs/framework/react/guide/column-faceting.md`
|
|
78
|
+
|
|
79
|
+
### [HIGH] Treating page facets as global
|
|
80
|
+
|
|
81
|
+
Wrong: `const globalCounts = column.getFacetedUniqueValues()`
|
|
82
|
+
|
|
83
|
+
Correct: `const globalCounts = await fetchFacetCounts(activeFilters)`
|
|
84
|
+
|
|
85
|
+
With server pagination, client faceting sees only loaded data.
|
|
86
|
+
|
|
87
|
+
Source: `docs/framework/react/guide/column-faceting.md#custom-server-side-faceting`
|
|
88
|
+
|
|
89
|
+
## API Discovery
|
|
90
|
+
|
|
91
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-faceting/` for exact getters and factory return types.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-filtering
|
|
3
|
+
description: >
|
|
4
|
+
Filter columns with columnFilteringFeature, filteredRowModel, filterFns, filterMeta, nested-row direction, and manualFiltering. Load for accessor compatibility, controlled filter updaters, fuzzy metadata, or client/server ownership.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features', 'client-vs-server']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-filtering.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-filtering'
|
|
15
|
+
- 'TanStack/table:examples/react/filters'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core`, `table-features`, and `client-vs-server`. Filtering state, row processing, and filter UI are separate concerns.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
columnFilteringFeature,
|
|
25
|
+
createFilteredRowModel,
|
|
26
|
+
filterFns,
|
|
27
|
+
tableFeatures,
|
|
28
|
+
} from '@tanstack/table-core'
|
|
29
|
+
|
|
30
|
+
export const features = tableFeatures({
|
|
31
|
+
columnFilteringFeature,
|
|
32
|
+
filteredRowModel: createFilteredRowModel(),
|
|
33
|
+
filterFns,
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Core Patterns
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const options = {
|
|
41
|
+
filterFromLeafRows: true,
|
|
42
|
+
maxLeafRowFilterDepth: 2,
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Use leaf-first filtering only when a parent should survive because a descendant matches.
|
|
47
|
+
|
|
48
|
+
## Common Mistakes
|
|
49
|
+
|
|
50
|
+
### [HIGH] Combining manual and client filtering
|
|
51
|
+
|
|
52
|
+
Wrong: `const options = { manualFiltering: true }`
|
|
53
|
+
|
|
54
|
+
Correct: `const options = { manualFiltering: false }`
|
|
55
|
+
|
|
56
|
+
Manual mode returns the pre-filtered model; send filter state to the server instead if it is `true`.
|
|
57
|
+
|
|
58
|
+
Source: `packages/table-core/src/features/column-filtering/columnFilteringFeature.types.ts`
|
|
59
|
+
|
|
60
|
+
### [HIGH] Filtering renderer output
|
|
61
|
+
|
|
62
|
+
Wrong: `helper.accessor(row => ({ label: row.status }), { filterFn: 'includesString' })`
|
|
63
|
+
|
|
64
|
+
Correct: `helper.accessor('status', { filterFn: 'includesString' })`
|
|
65
|
+
|
|
66
|
+
Built-in string and numeric filters expect comparable accessor values, not objects or UI nodes.
|
|
67
|
+
|
|
68
|
+
Source: `docs/framework/react/guide/column-filtering.md#filterfns`
|
|
69
|
+
|
|
70
|
+
### [HIGH] Ignoring updater-function callbacks
|
|
71
|
+
|
|
72
|
+
Wrong: `onColumnFiltersChange: value => { columnFilters = value as ColumnFiltersState }`
|
|
73
|
+
|
|
74
|
+
Correct: `onColumnFiltersChange: updater => { columnFilters = functionalUpdate(updater, columnFilters) }`
|
|
75
|
+
|
|
76
|
+
Controlled callbacks receive either a value or a function of previous state.
|
|
77
|
+
|
|
78
|
+
Source: `packages/table-core/src/features/column-filtering/columnFilteringFeature.types.ts`
|
|
79
|
+
|
|
80
|
+
## API Discovery
|
|
81
|
+
|
|
82
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-filtering/` and `src/fns/filterFns.ts` for exact signatures and auto-remove behavior.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-ordering
|
|
3
|
+
description: >
|
|
4
|
+
Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-ordering.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-ordering'
|
|
15
|
+
- 'TanStack/table:examples/react/column-dnd'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core` and `table-features`. `columnOrder` orders unpinned leaf IDs; other plugins can still determine the final visual regions.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { columnOrderingFeature, tableFeatures } from '@tanstack/table-core'
|
|
24
|
+
|
|
25
|
+
export const features = tableFeatures({ columnOrderingFeature })
|
|
26
|
+
export const initialState = { columnOrder: ['name', 'age', 'actions'] }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Core Patterns
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const next = columnOrder.filter((id) => id !== activeId)
|
|
33
|
+
next.splice(next.indexOf(overId), 0, activeId)
|
|
34
|
+
table.setColumnOrder(next)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use column IDs as drag identities and replace the array.
|
|
38
|
+
|
|
39
|
+
## Common Mistakes
|
|
40
|
+
|
|
41
|
+
### [HIGH] Assuming state is final order
|
|
42
|
+
|
|
43
|
+
Wrong: `renderIds(columnOrder)`
|
|
44
|
+
|
|
45
|
+
Correct: `renderColumns(table.getAllLeafColumns())`
|
|
46
|
+
|
|
47
|
+
Pinning regions and grouping mode apply after base ordering. If
|
|
48
|
+
`columnVisibilityFeature` is also registered, render
|
|
49
|
+
`table.getVisibleLeafColumns()` to apply visibility too.
|
|
50
|
+
|
|
51
|
+
Source: `docs/framework/react/guide/column-ordering.md#what-affects-column-order`
|
|
52
|
+
|
|
53
|
+
### [HIGH] Using labels as identities
|
|
54
|
+
|
|
55
|
+
Wrong: `const activeId = column.columnDef.header as string`
|
|
56
|
+
|
|
57
|
+
Correct: `const activeId = column.id`
|
|
58
|
+
|
|
59
|
+
Headers can collide or change; ordering state stores stable leaf column IDs.
|
|
60
|
+
|
|
61
|
+
Source: `packages/table-core/src/features/column-ordering/columnOrderingFeature.types.ts`
|
|
62
|
+
|
|
63
|
+
### [HIGH] Mutating controlled state in place
|
|
64
|
+
|
|
65
|
+
Wrong: `columnOrder.splice(0, 1); table.setColumnOrder(columnOrder)`
|
|
66
|
+
|
|
67
|
+
Correct: `table.setColumnOrder(columnOrder.slice(1))`
|
|
68
|
+
|
|
69
|
+
Reactive owners commonly require a new array reference.
|
|
70
|
+
|
|
71
|
+
Source: `examples/react/column-dnd/src/main.tsx`
|
|
72
|
+
|
|
73
|
+
## API Discovery
|
|
74
|
+
|
|
75
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-ordering/`; combine with pinning/visibility skills when those plugins are registered.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-pinning
|
|
3
|
+
description: >
|
|
4
|
+
Pin columns into logical start, center, and end regions with columnPinningFeature and renderer-owned sticky CSS. Load for RTL offsets, z-index, backgrounds, overflow, widths, gaps, or overlaps.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features', 'column-sizing']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-pinning.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-pinning'
|
|
15
|
+
- 'TanStack/table:examples/react/column-pinning-sticky'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core`, `table-features`, and `column-sizing`. Pinning partitions models; CSS creates the sticky visual result.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
columnPinningFeature,
|
|
25
|
+
columnSizingFeature,
|
|
26
|
+
tableFeatures,
|
|
27
|
+
} from '@tanstack/table-core'
|
|
28
|
+
|
|
29
|
+
export const features = tableFeatures({
|
|
30
|
+
columnSizingFeature,
|
|
31
|
+
columnPinningFeature,
|
|
32
|
+
})
|
|
33
|
+
export const initialState = {
|
|
34
|
+
columnPinning: { start: ['name'], end: ['actions'] },
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Core Patterns
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const style = (column: Column<any, any>) => ({
|
|
42
|
+
position: column.getIsPinned() ? 'sticky' : 'relative',
|
|
43
|
+
insetInlineStart:
|
|
44
|
+
column.getIsPinned() === 'start'
|
|
45
|
+
? `${column.getStart('start')}px`
|
|
46
|
+
: undefined,
|
|
47
|
+
insetInlineEnd:
|
|
48
|
+
column.getIsPinned() === 'end' ? `${column.getAfter('end')}px` : undefined,
|
|
49
|
+
width: `${column.getSize()}px`,
|
|
50
|
+
zIndex: column.getIsPinned() ? 1 : 0,
|
|
51
|
+
background: 'Canvas',
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Common Mistakes
|
|
56
|
+
|
|
57
|
+
### [HIGH] Using physical v8 regions
|
|
58
|
+
|
|
59
|
+
Wrong: `column.pin('left')`
|
|
60
|
+
|
|
61
|
+
Correct: `column.pin('start')`
|
|
62
|
+
|
|
63
|
+
V9 uses logical `start` and `end`, including state and collection APIs.
|
|
64
|
+
|
|
65
|
+
Source: `docs/framework/react/guide/migrating.md#column-pinning`
|
|
66
|
+
|
|
67
|
+
### [HIGH] Expecting sticky CSS automatically
|
|
68
|
+
|
|
69
|
+
Wrong: `column.pin('start')`
|
|
70
|
+
|
|
71
|
+
Correct: `Object.assign(cell.style, style(column))`
|
|
72
|
+
|
|
73
|
+
The feature only computes regions and offsets; the renderer owns positioning, backgrounds, overflow, and stacking.
|
|
74
|
+
|
|
75
|
+
Source: `examples/react/column-pinning-sticky/src/main.tsx`
|
|
76
|
+
|
|
77
|
+
### [HIGH] Diverging rendered and model widths
|
|
78
|
+
|
|
79
|
+
Wrong: `cell.style.width = 'auto'`
|
|
80
|
+
|
|
81
|
+
Correct: `cell.style.width = `${column.getSize()}px``
|
|
82
|
+
|
|
83
|
+
Sticky offsets use numeric sizes, so mismatched DOM widths create gaps or overlaps.
|
|
84
|
+
|
|
85
|
+
Source: `docs/framework/react/guide/column-pinning.md#useful-column-pinning-apis`
|
|
86
|
+
|
|
87
|
+
## API Discovery
|
|
88
|
+
|
|
89
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-pinning/`; use CSS logical properties for direction-aware rendering.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-resizing
|
|
3
|
+
description: >
|
|
4
|
+
Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features', 'column-sizing']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-resizing.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-resizing'
|
|
15
|
+
- 'TanStack/table:examples/react/column-resizing-performant'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core`, `table-features`, and `column-sizing`. Resizing supplies gesture APIs and state; the renderer supplies handles and widths.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
columnResizingFeature,
|
|
25
|
+
columnSizingFeature,
|
|
26
|
+
tableFeatures,
|
|
27
|
+
} from '@tanstack/table-core'
|
|
28
|
+
|
|
29
|
+
export const features = tableFeatures({
|
|
30
|
+
columnSizingFeature,
|
|
31
|
+
columnResizingFeature,
|
|
32
|
+
})
|
|
33
|
+
export const options = {
|
|
34
|
+
columnResizeMode: 'onChange' as const,
|
|
35
|
+
columnResizeDirection: 'ltr' as const,
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Core Patterns
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
const handler = header.getResizeHandler()
|
|
43
|
+
handle.addEventListener('mousedown', handler)
|
|
44
|
+
handle.addEventListener('touchstart', handler)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For large grids, compute all visible sizes once per update and expose them as CSS variables.
|
|
48
|
+
|
|
49
|
+
## Common Mistakes
|
|
50
|
+
|
|
51
|
+
### [CRITICAL] Omitting sizing prerequisite
|
|
52
|
+
|
|
53
|
+
Wrong: `tableFeatures({ columnResizingFeature })`
|
|
54
|
+
|
|
55
|
+
Correct: `tableFeatures({ columnSizingFeature, columnResizingFeature })`
|
|
56
|
+
|
|
57
|
+
Resizing modifies the sizing state and requires `columnSizingFeature`.
|
|
58
|
+
|
|
59
|
+
Source: `packages/table-core/src/types/TableFeatures.ts#FeatureSlotPrereqs`
|
|
60
|
+
|
|
61
|
+
### [HIGH] Rendering an inert handle
|
|
62
|
+
|
|
63
|
+
Wrong: `handle.addEventListener('pointerdown', header.getResizeHandler())`
|
|
64
|
+
|
|
65
|
+
Correct:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
const handler = header.getResizeHandler()
|
|
69
|
+
handle.addEventListener('mousedown', handler)
|
|
70
|
+
handle.addEventListener('touchstart', handler)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The shipped handler distinguishes `touchstart` from the mouse path. A single
|
|
74
|
+
`pointerdown` listener does not provide working touch resizing; wire both mouse
|
|
75
|
+
and touch start events.
|
|
76
|
+
|
|
77
|
+
Source: `docs/framework/react/guide/column-resizing.md#connect-column-resizing-apis-to-ui`
|
|
78
|
+
|
|
79
|
+
### [MEDIUM] Reading sizes in every cell
|
|
80
|
+
|
|
81
|
+
Wrong: `cells.forEach(cell => cell.style.width = `${cell.column.getSize()}px`)`
|
|
82
|
+
|
|
83
|
+
Correct: `root.style.setProperty(`--col-${header.id}`, `${header.getSize()}px`)`
|
|
84
|
+
|
|
85
|
+
Caching sizes or CSS variables avoids repeated work during `onChange` resizing.
|
|
86
|
+
|
|
87
|
+
Source: `examples/react/column-resizing-performant/src/main.tsx`
|
|
88
|
+
|
|
89
|
+
## API Discovery
|
|
90
|
+
|
|
91
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-resizing/` and the sizing feature directory for the state it updates.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-sizing
|
|
3
|
+
description: >
|
|
4
|
+
Use columnSizingFeature numeric size, minSize, maxSize, getSize, getStart, getAfter, and total-size APIs in table, grid, or flex CSS. Load for auto or percentage misconceptions and sizing/pinning layout mismatch.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-sizing.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-sizing'
|
|
15
|
+
- 'TanStack/table:examples/react/column-sizing'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core` and `table-features`. Sizing is numeric state; translating it to layout is a renderer decision.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { columnSizingFeature, tableFeatures } from '@tanstack/table-core'
|
|
24
|
+
|
|
25
|
+
export const features = tableFeatures({ columnSizingFeature })
|
|
26
|
+
export const defaultColumn = { size: 180, minSize: 80, maxSize: 480 }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Core Patterns
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
cell.style.width = `${cell.column.getSize()}px`
|
|
33
|
+
tableElement.style.width = `${table.getTotalSize()}px`
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Apply the same model sizes consistently to headers, cells, and pinned offsets.
|
|
37
|
+
|
|
38
|
+
## Common Mistakes
|
|
39
|
+
|
|
40
|
+
### [HIGH] Expecting state to style DOM
|
|
41
|
+
|
|
42
|
+
Wrong: `const options = { defaultColumn: { size: 180 } }`
|
|
43
|
+
|
|
44
|
+
Correct: `cell.style.width = `${cell.column.getSize()}px``
|
|
45
|
+
|
|
46
|
+
Numeric state does not apply CSS to headless markup.
|
|
47
|
+
|
|
48
|
+
Source: `docs/framework/react/guide/column-sizing.md#column-size-apis`
|
|
49
|
+
|
|
50
|
+
### [HIGH] Passing CSS sizes into numeric APIs
|
|
51
|
+
|
|
52
|
+
Wrong: `const column = { size: '25%' }`
|
|
53
|
+
|
|
54
|
+
Correct: `const column = { size: 240 }`
|
|
55
|
+
|
|
56
|
+
Table sizing state is numeric; percentages and auto layout belong in renderer CSS.
|
|
57
|
+
|
|
58
|
+
Source: `packages/table-core/src/features/column-sizing/columnSizingFeature.types.ts`
|
|
59
|
+
|
|
60
|
+
### [HIGH] Letting content override offsets
|
|
61
|
+
|
|
62
|
+
Wrong: `cell.style.minWidth = 'max-content'`
|
|
63
|
+
|
|
64
|
+
Correct: `cell.style.width = `${column.getSize()}px`; cell.style.overflow = 'hidden'`
|
|
65
|
+
|
|
66
|
+
If rendered width differs from the model, totals and pinning offsets no longer match geometry.
|
|
67
|
+
|
|
68
|
+
Source: `examples/react/column-sizing/src/main.tsx`
|
|
69
|
+
|
|
70
|
+
## API Discovery
|
|
71
|
+
|
|
72
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-sizing/` for defaults and region-aware offset signatures.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: column-visibility
|
|
3
|
+
description: >
|
|
4
|
+
Hide columns with columnVisibilityFeature while rendering visibility-aware header, column, and cell collections. Load when hidden columns remain in the DOM, false-versus-absent state is confused, or enableHiding is misunderstood.
|
|
5
|
+
metadata:
|
|
6
|
+
{
|
|
7
|
+
type: sub-skill,
|
|
8
|
+
library: '@tanstack/table-core',
|
|
9
|
+
library_version: '9.0.0-beta.42',
|
|
10
|
+
}
|
|
11
|
+
requires: ['core', 'table-features']
|
|
12
|
+
sources:
|
|
13
|
+
- 'TanStack/table:docs/framework/react/guide/column-visibility.md'
|
|
14
|
+
- 'TanStack/table:packages/table-core/src/features/column-visibility'
|
|
15
|
+
- 'TanStack/table:examples/react/column-visibility'
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This skill builds on `core` and `table-features`. Visibility state changes visibility-aware models; it never removes the column definition.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { columnVisibilityFeature, tableFeatures } from '@tanstack/table-core'
|
|
24
|
+
|
|
25
|
+
export const features = tableFeatures({ columnVisibilityFeature })
|
|
26
|
+
export const initialState = { columnVisibility: { internalId: false } }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Core Patterns
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const headers = table.getHeaderGroups()
|
|
33
|
+
const cells = row.getVisibleCells()
|
|
34
|
+
const toggles = table
|
|
35
|
+
.getAllLeafColumns()
|
|
36
|
+
.filter((column) => column.getCanHide())
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use all-column APIs for controls and visible APIs for rendered table content.
|
|
40
|
+
|
|
41
|
+
## Common Mistakes
|
|
42
|
+
|
|
43
|
+
### [HIGH] Rendering hidden cells anyway
|
|
44
|
+
|
|
45
|
+
Wrong: `row.getAllCells().map(renderCell)`
|
|
46
|
+
|
|
47
|
+
Correct: `row.getVisibleCells().map(renderCell)`
|
|
48
|
+
|
|
49
|
+
All-cell APIs intentionally include hidden columns.
|
|
50
|
+
|
|
51
|
+
Source: `docs/framework/react/guide/column-visibility.md#column-visibility-aware-table-apis`
|
|
52
|
+
|
|
53
|
+
### [HIGH] Treating absence as hidden
|
|
54
|
+
|
|
55
|
+
Wrong: `const hidden = !columnVisibility[column.id]`
|
|
56
|
+
|
|
57
|
+
Correct: `const hidden = columnVisibility[column.id] === false`
|
|
58
|
+
|
|
59
|
+
Only explicit `false` hides a column; an absent entry is visible.
|
|
60
|
+
|
|
61
|
+
Source: `packages/table-core/src/features/column-visibility/columnVisibilityFeature.ts`
|
|
62
|
+
|
|
63
|
+
### [MEDIUM] Treating enableHiding as visibility
|
|
64
|
+
|
|
65
|
+
Wrong: `helper.accessor('id', { enableHiding: false })`
|
|
66
|
+
|
|
67
|
+
Correct: `const initialState = { columnVisibility: { id: false } }`
|
|
68
|
+
|
|
69
|
+
`enableHiding` controls whether hiding is allowed; visibility belongs in table state.
|
|
70
|
+
|
|
71
|
+
Source: `packages/table-core/src/features/column-visibility/columnVisibilityFeature.types.ts`
|
|
72
|
+
|
|
73
|
+
## API Discovery
|
|
74
|
+
|
|
75
|
+
Inspect `node_modules/@tanstack/table-core/src/features/column-visibility/` for visibility-aware table, row, and column APIs.
|