Skip to content

Commit 8a24b14

Browse files
committed
chore: introduce TFeatures generic
1 parent bec8968 commit 8a24b14

125 files changed

Lines changed: 3161 additions & 1867 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/core/cell.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Renders the value for a cell the same as `getValue`, but will return the `render
3535
### `row`
3636

3737
```tsx
38-
row: Row<TData>
38+
row: Row<TFeatures, TData>
3939
```
4040

4141
The associated Row object for the cell.
4242

4343
### `column`
4444

4545
```tsx
46-
column: Column<TData>
46+
column: Column<TFeatures, TData>
4747
```
4848

4949
The associated Column object for the cell.
@@ -52,12 +52,12 @@ The associated Column object for the cell.
5252

5353
```tsx
5454
getContext: () => {
55-
table: Table<TData>
56-
column: Column<TData, TValue>
57-
row: Row<TData>
58-
cell: Cell<TData, TValue>
59-
getValue: <TTValue = TValue,>() => TTValue
60-
renderValue: <TTValue = TValue,>() => TTValue | null
55+
table: Table<TFeatures, TData>
56+
column: Column<TFeatures, TData, TValue>
57+
row: Row<TFeatures, TData>
58+
cell: Cell<TFeatures, TData, TValue>
59+
getValue: <TTValue = TValue extends CellData = CellData>() => TTValue
60+
renderValue: <TTValue = TValue extends CellData = CellData>() => TTValue | null
6161
}
6262
```
6363

docs/api/core/column-def.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The accessor function to use when extracting the value for the column from each
3838
### `columns`
3939

4040
```tsx
41-
columns?: ColumnDef<TData>[]
41+
columns?: ColumnDef<TFeatures, TData>[]
4242
```
4343

4444
The child column defs to include in a group column.
@@ -49,9 +49,9 @@ The child column defs to include in a group column.
4949
header?:
5050
| string
5151
| ((props: {
52-
table: Table<TData>
53-
header: Header<TData>
54-
column: Column<TData>
52+
table: Table<TFeatures, TData>
53+
header: Header<TFeatures, TData>
54+
column: Column<TFeatures, TData>
5555
}) => unknown)
5656
```
5757

@@ -63,9 +63,9 @@ The header to display for the column. If a string is passed, it can be used as a
6363
footer?:
6464
| string
6565
| ((props: {
66-
table: Table<TData>
67-
header: Header<TData>
68-
column: Column<TData>
66+
table: Table<TFeatures, TData>
67+
header: Header<TFeatures, TData>
68+
column: Column<TFeatures, TData>
6969
}) => unknown)
7070
```
7171

@@ -77,10 +77,10 @@ The footer to display for the column. If a function is passed, it will be passed
7777
cell?:
7878
| string
7979
| ((props: {
80-
table: Table<TData>
81-
row: Row<TData>
82-
column: Column<TData>
83-
cell: Cell<TData>
80+
table: Table<TFeatures, TData>
81+
row: Row<TFeatures, TData>
82+
column: Column<TFeatures, TData>
83+
cell: Cell<TFeatures, TData>
8484
getValue: () => any
8585
renderValue: () => any
8686
}) => unknown)
@@ -100,7 +100,7 @@ The meta data to be associated with the column. We can access it anywhere when t
100100
import '@tanstack/react-table' //or vue, svelte, solid, qwik, etc.
101101
102102
declare module '@tanstack/react-table' {
103-
interface ColumnMeta<TData extends RowData, TValue> {
103+
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue> {
104104
foo: string
105105
}
106106
}

docs/api/core/column.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,39 @@ The resolved accessor function to use when extracting the value for the column f
3939
### `columnDef`
4040

4141
```tsx
42-
columnDef: ColumnDef<TData>
42+
columnDef: ColumnDef<TFeatures, TData>
4343
```
4444

4545
The original column def used to create the column.
4646

4747
### `columns`
4848

4949
```tsx
50-
type columns = ColumnDef<TData>[]
50+
type columns = ColumnDef<TFeatures, TData>[]
5151
```
5252
5353
The child column (if the column is a group column). Will be an empty array if the column is not a group column.
5454
5555
### `parent`
5656
5757
```tsx
58-
parent?: Column<TData>
58+
parent?: Column<TFeatures, TData>
5959
```
6060
6161
The parent column for this column. Will be undefined if this is a root column.
6262
6363
### `getFlatColumns`
6464
6565
```tsx
66-
type getFlatColumns = () => Column<TData>[]
66+
type getFlatColumns = () => Column<TFeatures, TData>[]
6767
```
6868
6969
Returns the flattened array of this column and all child/grand-child columns for this column.
7070
7171
### `getLeafColumns`
7272
7373
```tsx
74-
type getLeafColumns = () => Column<TData>[]
74+
type getLeafColumns = () => Column<TFeatures, TData>[]
7575
```
7676
7777
Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column.

docs/api/core/header-group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The depth of the header group, zero-indexed based.
2727
### `headers`
2828

2929
```tsx
30-
type headers = Header<TData>[]
30+
type headers = Header<TFeatures, TData>[]
3131
```
3232
3333
An array of [Header](../header) objects that belong to this header group

docs/api/core/header.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ The depth of the header, zero-indexed based.
3535
### `column`
3636

3737
```tsx
38-
column: Column<TData>
38+
column: Column<TFeatures, TData>
3939
```
4040

4141
The header's associated [Column](../column) object
4242

4343
### `headerGroup`
4444

4545
```tsx
46-
headerGroup: HeaderGroup<TData>
46+
headerGroup: HeaderGroup<TFeatures, TData>
4747
```
4848

4949
The header's associated [HeaderGroup](../header-group) object
5050

5151
### `subHeaders`
5252

5353
```tsx
54-
type subHeaders = Header<TData>[]
54+
type subHeaders = Header<TFeatures, TData>[]
5555
```
5656
5757
The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column.
@@ -75,7 +75,7 @@ The row-span for the header.
7575
### `getLeafHeaders`
7676
7777
```tsx
78-
type getLeafHeaders = () => Header<TData>[]
78+
type getLeafHeaders = () => Header<TFeatures, TData>[]
7979
```
8080
8181
Returns the leaf headers hierarchically nested under this header.
@@ -100,9 +100,9 @@ If the header is a placeholder header, this will be a unique header ID that does
100100
101101
```tsx
102102
getContext: () => {
103-
table: Table<TData>
104-
header: Header<TData, TValue>
105-
column: Column<TData, TValue>
103+
table: Table<TFeatures, TData>
104+
header: Header<TFeatures, TData, TValue>
105+
column: Column<TFeatures, TData, TValue>
106106
}
107107
```
108108
@@ -117,127 +117,127 @@ flexRender(header.column.columnDef.header, header.getContext())
117117
### `getHeaderGroups`
118118
119119
```tsx
120-
type getHeaderGroups = () => HeaderGroup<TData>[]
120+
type getHeaderGroups = () => HeaderGroup<TFeatures, TData>[]
121121
```
122122
123123
Returns all header groups for the table.
124124
125125
### `getLeftHeaderGroups`
126126
127127
```tsx
128-
type getLeftHeaderGroups = () => HeaderGroup<TData>[]
128+
type getLeftHeaderGroups = () => HeaderGroup<TFeatures, TData>[]
129129
```
130130
131131
If pinning, returns the header groups for the left pinned columns.
132132
133133
### `getCenterHeaderGroups`
134134
135135
```tsx
136-
type getCenterHeaderGroups = () => HeaderGroup<TData>[]
136+
type getCenterHeaderGroups = () => HeaderGroup<TFeatures, TData>[]
137137
```
138138
139139
If pinning, returns the header groups for columns that are not pinned.
140140
141141
### `getRightHeaderGroups`
142142
143143
```tsx
144-
type getRightHeaderGroups = () => HeaderGroup<TData>[]
144+
type getRightHeaderGroups = () => HeaderGroup<TFeatures, TData>[]
145145
```
146146
147147
If pinning, returns the header groups for the right pinned columns.
148148
149149
### `getFooterGroups`
150150
151151
```tsx
152-
type getFooterGroups = () => HeaderGroup<TData>[]
152+
type getFooterGroups = () => HeaderGroup<TFeatures, TData>[]
153153
```
154154
155155
Returns all footer groups for the table.
156156
157157
### `getLeftFooterGroups`
158158
159159
```tsx
160-
type getLeftFooterGroups = () => HeaderGroup<TData>[]
160+
type getLeftFooterGroups = () => HeaderGroup<TFeatures, TData>[]
161161
```
162162
163163
If pinning, returns the footer groups for the left pinned columns.
164164
165165
### `getCenterFooterGroups`
166166
167167
```tsx
168-
type getCenterFooterGroups = () => HeaderGroup<TData>[]
168+
type getCenterFooterGroups = () => HeaderGroup<TFeatures, TData>[]
169169
```
170170
171171
If pinning, returns the footer groups for columns that are not pinned.
172172
173173
### `getRightFooterGroups`
174174
175175
```tsx
176-
type getRightFooterGroups = () => HeaderGroup<TData>[]
176+
type getRightFooterGroups = () => HeaderGroup<TFeatures, TData>[]
177177
```
178178
179179
If pinning, returns the footer groups for the right pinned columns.
180180
181181
### `getFlatHeaders`
182182
183183
```tsx
184-
type getFlatHeaders = () => Header<TData, unknown>[]
184+
type getFlatHeaders = () => Header<TFeatures, TData, unknown>[]
185185
```
186186
187187
Returns headers for all columns in the table, including parent headers.
188188
189189
### `getLeftFlatHeaders`
190190
191191
```tsx
192-
type getLeftFlatHeaders = () => Header<TData, unknown>[]
192+
type getLeftFlatHeaders = () => Header<TFeatures, TData, unknown>[]
193193
```
194194
195195
If pinning, returns headers for all left pinned columns in the table, including parent headers.
196196
197197
### `getCenterFlatHeaders`
198198
199199
```tsx
200-
type getCenterFlatHeaders = () => Header<TData, unknown>[]
200+
type getCenterFlatHeaders = () => Header<TFeatures, TData, unknown>[]
201201
```
202202
203203
If pinning, returns headers for all columns that are not pinned, including parent headers.
204204
205205
### `getRightFlatHeaders`
206206
207207
```tsx
208-
type getRightFlatHeaders = () => Header<TData, unknown>[]
208+
type getRightFlatHeaders = () => Header<TFeatures, TData, unknown>[]
209209
```
210210
211211
If pinning, returns headers for all right pinned columns in the table, including parent headers.
212212
213213
### `getLeafHeaders`
214214
215215
```tsx
216-
type getLeafHeaders = () => Header<TData, unknown>[]
216+
type getLeafHeaders = () => Header<TFeatures, TData, unknown>[]
217217
```
218218
219219
Returns headers for all leaf columns in the table, (not including parent headers).
220220
221221
### `getLeftLeafHeaders`
222222
223223
```tsx
224-
type getLeftLeafHeaders = () => Header<TData, unknown>[]
224+
type getLeftLeafHeaders = () => Header<TFeatures, TData, unknown>[]
225225
```
226226
227227
If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers).
228228
229229
### `getCenterLeafHeaders`
230230
231231
```tsx
232-
type getCenterLeafHeaders = () => Header<TData, unknown>[]
232+
type getCenterLeafHeaders = () => Header<TFeatures, TData, unknown>[]
233233
```
234234
235235
If pinning, returns headers for all columns that are not pinned, (not including parent headers).
236236
237237
### `getRightLeafHeaders`
238238
239239
```tsx
240-
type getRightLeafHeaders = () => Header<TData, unknown>[]
240+
type getRightLeafHeaders = () => Header<TFeatures, TData, unknown>[]
241241
```
242242
243243
If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers).

docs/api/core/row.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,31 @@ Returns a unique array of values from the row for a given columnId.
7777
### `subRows`
7878

7979
```tsx
80-
type subRows = Row<TData>[]
80+
type subRows = Row<TFeatures, TData>[]
8181
```
8282
8383
An array of subRows for the row as returned and created by the `options.getSubRows` option.
8484
8585
### `getParentRow`
8686
8787
```tsx
88-
type getParentRow = () => Row<TData> | undefined
88+
type getParentRow = () => Row<TFeatures, TData> | undefined
8989
```
9090
9191
Returns the parent row for the row, if it exists.
9292
9393
### `getParentRows`
9494
9595
```tsx
96-
type getParentRows = () => Row<TData>[]
96+
type getParentRows = () => Row<TFeatures, TData>[]
9797
```
9898
9999
Returns the parent rows for the row, all the way up to a root row.
100100
101101
### `getLeafRows`
102102
103103
```tsx
104-
type getLeafRows = () => Row<TData>[]
104+
type getLeafRows = () => Row<TFeatures, TData>[]
105105
```
106106
107107
Returns the leaf rows for the row, not including any parent rows.
@@ -117,7 +117,7 @@ An array of the original subRows as returned by the `options.getSubRows` option.
117117
### `getAllCells`
118118
119119
```tsx
120-
type getAllCells = () => Cell<TData>[]
120+
type getAllCells = () => Cell<TFeatures, TData>[]
121121
```
122122
123123
Returns all of the [Cells](../cell) for the row.

0 commit comments

Comments
 (0)