@tanstack/angular-table 9.0.0-beta.38 → 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.
Files changed (25) hide show
  1. package/README.md +1 -0
  2. package/dist/README.md +1 -0
  3. package/package.json +2 -2
  4. package/skills/create-table-hook/SKILL.md +148 -0
  5. package/skills/getting-started/SKILL.md +138 -0
  6. package/skills/migrate-v8-to-v9/SKILL.md +194 -0
  7. package/skills/table-state/SKILL.md +197 -0
  8. package/skills/with-tanstack-query/SKILL.md +142 -0
  9. package/skills/with-tanstack-virtual/SKILL.md +126 -0
  10. package/skills/angular/angular-rendering-directives/SKILL.md +0 -415
  11. package/skills/angular/angular-rendering-directives/references/content-shapes.md +0 -142
  12. package/skills/angular/angular-rendering-directives/references/create-table-hook-registries.md +0 -89
  13. package/skills/angular/angular-rendering-directives/references/di-tokens.md +0 -171
  14. package/skills/angular/angular-rendering-directives/references/flex-render-component-options.md +0 -64
  15. package/skills/angular/client-to-server/SKILL.md +0 -468
  16. package/skills/angular/compose-with-tanstack-query/SKILL.md +0 -486
  17. package/skills/angular/compose-with-tanstack-store/SKILL.md +0 -405
  18. package/skills/angular/compose-with-tanstack-virtual/SKILL.md +0 -399
  19. package/skills/angular/getting-started/SKILL.md +0 -487
  20. package/skills/angular/getting-started/references/feature-row-model-mapping.md +0 -51
  21. package/skills/angular/migrate-v8-to-v9/SKILL.md +0 -422
  22. package/skills/angular/migrate-v8-to-v9/references/v8-to-v9-mapping.md +0 -268
  23. package/skills/angular/production-readiness/SKILL.md +0 -472
  24. package/skills/angular/table-state/SKILL.md +0 -422
  25. package/skills/angular/table-state/references/external-atoms-and-app-hook.md +0 -153
@@ -0,0 +1,197 @@
1
+ ---
2
+ name: table-state
3
+ description: >
4
+ Use Angular-signal-backed table.atoms, direct template reads, computed selectors, controlled signals, value-or-updater callbacks, and external Angular Store atoms while accounting for injectTable initializer reruns.
5
+ metadata:
6
+ type: framework
7
+ library: '@tanstack/angular-table'
8
+ framework: angular
9
+ library_version: '9.0.0-beta.42'
10
+ requires:
11
+ - '@tanstack/table-core#core'
12
+ - getting-started
13
+ sources:
14
+ - 'TanStack/table:docs/framework/angular/guide/table-state.md'
15
+ - 'TanStack/table:examples/angular/basic-external-state'
16
+ - 'TanStack/table:packages/angular-table/src/injectTable.ts'
17
+ ---
18
+
19
+ This skill builds on `@tanstack/table-core#core` and `getting-started`. Read them first for state ownership and Angular construction.
20
+
21
+ ## State Mental Model
22
+
23
+ TanStack Table is primarily a state coordinator. Keep state internal unless another system must read, persist, or drive it. Without `initialState`, `atoms`, `state`, or `on[State]Change`, the table owns all registered slices.
24
+
25
+ - `table.baseAtoms` are internal writable atoms initialized from resolved initial state.
26
+ - `table.atoms` are readonly derived atoms for the active owner of each registered slice.
27
+ - `table.store` combines those atoms into one readonly flat store.
28
+
29
+ The Angular adapter backs atoms with Angular signals. Reads participate in tracking inside templates, `computed`, and `effect`; signal reads inside the `injectTable` initializer also rerun that initializer and call `setOptions`. State is feature-based: missing pagination state or APIs indicate a missing `rowPaginationFeature`. Hoist stable `features` and `columns` outside the initializer, and return signal-backed `data` without mapping or slicing inline.
30
+
31
+ ## Setup
32
+
33
+ ```ts
34
+ import { computed, signal } from '@angular/core'
35
+ import {
36
+ injectTable,
37
+ rowPaginationFeature,
38
+ tableFeatures,
39
+ } from '@tanstack/angular-table'
40
+
41
+ const features = tableFeatures({ rowPaginationFeature })
42
+ const columns = [{ accessorKey: 'name' }]
43
+
44
+ export class TableComponent {
45
+ readonly data = signal([{ name: 'Ada' }])
46
+ readonly table = injectTable(() => ({ features, columns, data: this.data() }))
47
+ readonly pageIndex = computed(
48
+ () => this.table.atoms.pagination.get().pageIndex,
49
+ )
50
+ }
51
+ ```
52
+
53
+ Angular-backed table atom reads are signal reads. Templates, `computed`, and `effect` track them directly.
54
+
55
+ ## Core Patterns
56
+
57
+ ### Prefer external atoms for cross-system state
58
+
59
+ ```ts
60
+ import { createAtom } from '@tanstack/angular-store'
61
+ import type { PaginationState } from '@tanstack/angular-table'
62
+
63
+ readonly paginationAtom = createAtom<PaginationState>({ pageIndex: 0, pageSize: 20 })
64
+ readonly table = injectTable(() => ({
65
+ features, columns, data: this.data(), atoms: { pagination: this.paginationAtom },
66
+ }))
67
+ ```
68
+
69
+ The atom can feed Query without making every state write rerun the Table initializer.
70
+
71
+ ### Resolve controlled signal updaters
72
+
73
+ ```ts
74
+ readonly pagination = signal({ pageIndex: 0, pageSize: 20 })
75
+ readonly table = injectTable(() => ({
76
+ features, columns, data: this.data(), state: { pagination: this.pagination() },
77
+ onPaginationChange: next => typeof next === 'function' ? this.pagination.update(next) : this.pagination.set(next),
78
+ }))
79
+ ```
80
+
81
+ ## Choose State Ownership
82
+
83
+ Use one owner for each slice:
84
+
85
+ - Prefer internal state and feature APIs for local interaction.
86
+ - Use `initialState` for starting/reset values; later changes do not reset current state.
87
+ - Prefer a stable atom from `@tanstack/angular-store` in `atoms` for Query or other cross-system state. Table APIs update it without a change callback.
88
+ - Use an Angular signal read in `state.<slice>` plus the matching callback for simple controlled state. Handle raw values and updater functions.
89
+
90
+ External atoms win over controlled `state`, which syncs into the internal base atom. Do not give a slice two owners. The global v8 `onStateChange` option is gone; subscribe to `table.store` when all state changes must be observed.
91
+
92
+ ## Initialize, Update, and Reset
93
+
94
+ Prefer feature methods such as `setSorting`, `nextPage`, `toggleVisibility`, and `toggleSelected`. Direct base-atom writes are a rare escape hatch for internal state; write the external atom when it owns a slice.
95
+
96
+ ```ts
97
+ this.table.resetSorting()
98
+ this.table.resetPagination()
99
+ this.table.resetPagination(true)
100
+ ```
101
+
102
+ Feature resets use `table.initialState` unless `true` requests the feature default, and can update external owners. Core `table.reset()` resets internal base atoms only. Use feature-specific types such as `PaginationState`; use `TableState<typeof features>` when the complete registered state type is needed.
103
+
104
+ ## Common Mistakes
105
+
106
+ ### MEDIUM Wrapping atoms redundantly
107
+
108
+ Wrong:
109
+
110
+ ```ts
111
+ readonly pagination = computed(() => computed(() => this.table.atoms.pagination.get())())
112
+ ```
113
+
114
+ Correct:
115
+
116
+ ```ts
117
+ readonly pagination = computed(() => this.table.atoms.pagination.get())
118
+ ```
119
+
120
+ Table atoms already bridge to Angular signals; one tracked read is sufficient.
121
+
122
+ Source: `docs/framework/angular/guide/table-state.md`
123
+
124
+ ### HIGH Ignoring initializer reruns
125
+
126
+ Wrong:
127
+
128
+ ```ts
129
+ injectTable(() => ({
130
+ features: tableFeatures({ rowPaginationFeature }),
131
+ columns: makeColumns(),
132
+ state: { pagination: this.pagination() },
133
+ data,
134
+ }))
135
+ ```
136
+
137
+ Correct:
138
+
139
+ ```ts
140
+ injectTable(() => ({
141
+ features,
142
+ columns,
143
+ state: { pagination: this.pagination() },
144
+ data,
145
+ }))
146
+ ```
147
+
148
+ Controlled signal writes rerun the initializer, so static work must remain outside it.
149
+
150
+ Source: `packages/angular-table/src/injectTable.ts`
151
+
152
+ ### HIGH Storing updater functions
153
+
154
+ Wrong:
155
+
156
+ ```ts
157
+ onPaginationChange: (next) => this.pagination.set(next)
158
+ ```
159
+
160
+ Correct:
161
+
162
+ ```ts
163
+ onPaginationChange: (next) =>
164
+ typeof next === 'function'
165
+ ? this.pagination.update(next)
166
+ : this.pagination.set(next)
167
+ ```
168
+
169
+ Callbacks receive a value or updater; assigning the function corrupts owned state.
170
+
171
+ Source: `examples/angular/basic-external-state/src/app/app.ts`
172
+
173
+ ### MEDIUM Giving one slice multiple owners
174
+
175
+ Wrong:
176
+
177
+ ```ts
178
+ { initialState: { pagination: start }, atoms: { pagination: this.paginationAtom } }
179
+ ```
180
+
181
+ Correct:
182
+
183
+ ```ts
184
+ {
185
+ atoms: {
186
+ pagination: this.paginationAtom
187
+ }
188
+ }
189
+ ```
190
+
191
+ External atoms/state override initial state; choose one owner for each slice.
192
+
193
+ Source: `docs/framework/angular/guide/table-state.md`
194
+
195
+ ## API Discovery
196
+
197
+ Inspect `node_modules/@tanstack/angular-table/src/injectTable.ts` and `reactivity.ts`; inspect `@tanstack/angular-store/src` for external atoms and installed core feature source for state APIs.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: with-tanstack-query
3
+ description: >
4
+ Compose Angular Query with signal-owned Table filtering, sorting, and pagination state using reactive query options, manual row-model boundaries, direct query data, server counts, and valid injection context.
5
+ metadata:
6
+ type: composition
7
+ library: '@tanstack/angular-table'
8
+ framework: angular
9
+ library_version: '9.0.0-beta.42'
10
+ requires:
11
+ - '@tanstack/table-core#client-vs-server'
12
+ - getting-started
13
+ - table-state
14
+ sources:
15
+ - 'TanStack/table:examples/angular/with-tanstack-query'
16
+ - 'TanStack/table:docs/framework/angular/guide/table-state.md'
17
+ - 'TanStack/table:docs/framework/angular/guide/pagination.md'
18
+ ---
19
+
20
+ This skill builds on `@tanstack/table-core#client-vs-server`, `getting-started`, and `table-state`. Decide the server-owned stages and dataset before wiring Query.
21
+
22
+ ## Setup
23
+
24
+ ```ts
25
+ import {
26
+ injectQuery,
27
+ keepPreviousData,
28
+ } from '@tanstack/angular-query-experimental'
29
+ import { signal } from '@angular/core'
30
+ import {
31
+ injectTable,
32
+ rowPaginationFeature,
33
+ tableFeatures,
34
+ } from '@tanstack/angular-table'
35
+
36
+ const features = tableFeatures({ rowPaginationFeature })
37
+ const EMPTY_ROWS: never[] = []
38
+
39
+ export class PeopleTable {
40
+ readonly pagination = signal({ pageIndex: 0, pageSize: 20 })
41
+ readonly query = injectQuery(() => ({
42
+ queryKey: [
43
+ 'people',
44
+ this.pagination().pageIndex,
45
+ this.pagination().pageSize,
46
+ ],
47
+ queryFn: () =>
48
+ fetch(
49
+ `/api/people?page=${this.pagination().pageIndex}&size=${this.pagination().pageSize}`,
50
+ ).then((r) => r.json()),
51
+ placeholderData: keepPreviousData,
52
+ }))
53
+ readonly table = injectTable(() => ({
54
+ features,
55
+ columns,
56
+ data: this.query.data()?.rows ?? EMPTY_ROWS,
57
+ rowCount: this.query.data()?.rowCount ?? 0,
58
+ manualPagination: true,
59
+ state: { pagination: this.pagination() },
60
+ onPaginationChange: (next) =>
61
+ typeof next === 'function'
62
+ ? this.pagination.update(next)
63
+ : this.pagination.set(next),
64
+ }))
65
+ }
66
+ ```
67
+
68
+ ## Core Patterns
69
+
70
+ ### Track every server-owned input
71
+
72
+ Read pagination, sorting, and filtering signals inside `injectQuery(() => ...)` and include them in the query key. Return data already processed for each manual stage.
73
+
74
+ ### Keep Query data authoritative
75
+
76
+ Read the Query signal directly in `injectTable`. Create another signal only for a deliberate editable draft with an explicit cache synchronization policy.
77
+
78
+ ## Common Mistakes
79
+
80
+ ### HIGH Capturing query inputs outside tracking
81
+
82
+ Wrong:
83
+
84
+ ```ts
85
+ const page = this.pagination().pageIndex
86
+ readonly query = injectQuery(() => ({ queryKey: ['people', page], queryFn }))
87
+ ```
88
+
89
+ Correct:
90
+
91
+ ```ts
92
+ readonly query = injectQuery(() => ({ queryKey: ['people', this.pagination().pageIndex], queryFn }))
93
+ ```
94
+
95
+ Signal reads inside the options function establish refetch dependencies.
96
+
97
+ Source: `examples/angular/with-tanstack-query/src/app/app.ts`
98
+
99
+ ### HIGH Expecting manual mode to request
100
+
101
+ Wrong:
102
+
103
+ ```ts
104
+ injectTable(() => ({ features, columns, data, manualPagination: true }))
105
+ ```
106
+
107
+ Correct:
108
+
109
+ ```ts
110
+ injectTable(() => ({
111
+ features,
112
+ columns,
113
+ data: this.query.data()?.rows ?? EMPTY_ROWS,
114
+ manualPagination: true,
115
+ }))
116
+ ```
117
+
118
+ Manual flags only bypass client row processing; Query performs network work.
119
+
120
+ Source: `examples/angular/with-tanstack-query/src/app/app.ts`
121
+
122
+ ### HIGH Omitting total counts
123
+
124
+ Wrong:
125
+
126
+ ```ts
127
+ { data: this.query.data()?.rows ?? EMPTY_ROWS, manualPagination: true }
128
+ ```
129
+
130
+ Correct:
131
+
132
+ ```ts
133
+ { data: this.query.data()?.rows ?? EMPTY_ROWS, rowCount: this.query.data()?.rowCount ?? 0, manualPagination: true }
134
+ ```
135
+
136
+ Table needs `rowCount` or `pageCount` to constrain navigation across server pages.
137
+
138
+ Source: `docs/framework/angular/guide/pagination.md`
139
+
140
+ ## API Discovery
141
+
142
+ Inspect installed `@tanstack/angular-table/src/injectTable.ts`, the relevant core feature source, and installed Angular Query source for the exact `injectQuery` package/version contract.
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: with-tanstack-virtual
3
+ description: >
4
+ Virtualize Angular Table final row or column models inside the correct injection and reactive lifecycle with signal counts, scroll elements, keys, measurement, transforms, sticky regions, grid/flex sizing, and infinite data.
5
+ metadata:
6
+ type: composition
7
+ library: '@tanstack/angular-table'
8
+ framework: angular
9
+ library_version: '9.0.0-beta.42'
10
+ requires:
11
+ - '@tanstack/table-core#core'
12
+ - getting-started
13
+ - table-state
14
+ sources:
15
+ - 'TanStack/table:docs/framework/angular/guide/virtualization.md'
16
+ - 'TanStack/table:examples/angular/virtualized-rows'
17
+ - 'TanStack/table:examples/angular/virtualized-columns'
18
+ - 'TanStack/table:examples/angular/virtualized-infinite-scrolling'
19
+ ---
20
+
21
+ This skill builds on `@tanstack/table-core#core`, `getting-started`, and `table-state`. Virtual is a rendering concern over final Table models, not a feature plugin.
22
+
23
+ ## Setup
24
+
25
+ ```ts
26
+ import { computed, viewChild } from '@angular/core'
27
+ import { injectVirtualizer } from '@tanstack/angular-virtual'
28
+ import type { ElementRef } from '@angular/core'
29
+
30
+ export class VirtualTable {
31
+ readonly scrollElement =
32
+ viewChild<ElementRef<HTMLDivElement>>('scrollElement')
33
+ readonly rows = computed(() => this.table.getRowModel().rows)
34
+ readonly rowVirtualizer = injectVirtualizer(() => ({
35
+ count: this.rows().length,
36
+ scrollElement: this.scrollElement()?.nativeElement,
37
+ estimateSize: () => 34,
38
+ getItemKey: (index) => this.rows()[index]!.id,
39
+ overscan: 5,
40
+ }))
41
+ readonly virtualRows = computed(() => this.rowVirtualizer.getVirtualItems())
42
+ readonly totalSize = computed(() => this.rowVirtualizer.getTotalSize())
43
+ }
44
+ ```
45
+
46
+ ## Core Patterns
47
+
48
+ ### Derive reactive models
49
+
50
+ Use `computed(() => table.getRowModel().rows)` and `computed(() => table.getVisibleLeafColumns())`. `injectVirtualizer` tracks signal reads in its initializer and requires injection context.
51
+
52
+ ### Own the layout contract
53
+
54
+ Give the scroll element bounded overflow, create a total-size spacer, and translate or measure each virtual item. Use grid/flex widths for dynamic rows/columns and keep sticky headers inside the correct scroll geometry.
55
+
56
+ ### Gate infinite fetches
57
+
58
+ When the last virtual item approaches fetched length, fetch only if more server rows exist and a request is not active. Manual sorting requires server-sorted pages and a reset/refetch policy.
59
+
60
+ ## Common Mistakes
61
+
62
+ ### CRITICAL Constructing outside injection context
63
+
64
+ Wrong:
65
+
66
+ ```ts
67
+ export function virtualize(options) {
68
+ return injectVirtualizer(() => options)
69
+ }
70
+ ```
71
+
72
+ Correct:
73
+
74
+ ```ts
75
+ export class VirtualTable {
76
+ readonly virtualizer = injectVirtualizer(() => options())
77
+ }
78
+ ```
79
+
80
+ The Angular virtualizer follows DI lifecycle rules just like `injectTable`.
81
+
82
+ Source: `examples/angular/virtualized-rows/src/app/app.ts`
83
+
84
+ ### HIGH Virtualizing raw data
85
+
86
+ Wrong:
87
+
88
+ ```ts
89
+ readonly rows = computed(() => this.data())
90
+ ```
91
+
92
+ Correct:
93
+
94
+ ```ts
95
+ readonly rows = computed(() => this.table.getRowModel().rows)
96
+ ```
97
+
98
+ Raw data bypasses Table filtering, sorting, expansion, grouping, and pagination.
99
+
100
+ Source: `docs/framework/angular/guide/virtualization.md`
101
+
102
+ ### HIGH Forgetting spacer and transforms
103
+
104
+ Wrong:
105
+
106
+ ```html
107
+ @for (item of virtualRows(); track item.key) {
108
+ <div>{{ rows()[item.index].id }}</div>
109
+ }
110
+ ```
111
+
112
+ Correct:
113
+
114
+ ```html
115
+ <div [style.height.px]="totalSize()" style="position:relative">
116
+ <div style="position:absolute"></div>
117
+ </div>
118
+ ```
119
+
120
+ Virtual computes ranges and sizes but does not apply DOM geometry, sticky CSS, or column widths.
121
+
122
+ Source: `examples/angular/virtualized-columns/src/app/app.ts`
123
+
124
+ ## API Discovery
125
+
126
+ Inspect installed `@tanstack/angular-table/src`, installed `@tanstack/angular-virtual/src`, and the maintained Angular examples for current row, column, measurement, and infinite patterns.