Skip to content

Commit 51ec839

Browse files
fix: Generic Maps => Slotted (but many fewer) Generics (#4079)
* fix: Generic Maps => Slotted (but many fewer) Generics * fix: renaming + docs * examples: find and replace * examples: find and replace * examples: find and replace * fix: find and replace * fix: more find and replace * fix: find and replace * fix: no.... TValue?? * fix: solid exampls * Update pr.yml * rename instance => table * Passing! * vue examples * docs * guide urls
1 parent 6e07462 commit 51ec839

138 files changed

Lines changed: 13106 additions & 5987 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.

.github/workflows/pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
node: [14, 16]
9+
node: [16]
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v2
@@ -15,4 +15,5 @@ jobs:
1515
- run: |
1616
npm install
1717
npm run build
18+
npm run typecheck
1819
npm run test

docs/adapters/react-table.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ title: React Table
44

55
The `@tanstack/react-table` adapter is a wrapper around the core table logic. Most of it's job is related to managing state the "react" way, providing types and the rendering implementation of cell/header/footer templates.
66

7-
## `useTableInstance`
7+
## `useReactTable`
88

9-
Takes a `table` and `options` object and returns a table instance.
9+
Takes a `table` and `options` object and returns a table.
1010

1111
```tsx
12-
import { createTable, useTableInstance } from '@tanstack/react-table'
13-
14-
const table = createTable()
12+
import { useReactTable } from '@tanstack/react-table'
1513

1614
function App() {
17-
const instance = useTableInstance(table, options)
15+
const table = useReactTable(options)
1816

1917
// ...render your table
2018
}

docs/adapters/solid-table.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ title: Solid Table
44

55
The `@tanstack/solid-table` adapter is a wrapper around the core table logic. Most of it's job is related to managing state the "solid" way, providing types and the rendering implementation of cell/header/footer templates.
66

7-
## `createTableInstance`
7+
## `createSolidTable`
88

9-
Takes a `table` and `options` object and returns a table instance.
9+
Takes a `table` and `options` object and returns a table.
1010

1111
```tsx
12-
import { createTable, createTableInstance } from '@tanstack/solid-table'
13-
14-
const table = createTable()
12+
import { createSolidTable } from '@tanstack/solid-table'
1513

1614
function App() {
17-
const instance = createTableInstance(table, options)
15+
const table = createSolidTable(options)
1816

1917
// ...render your table
2018
}

docs/adapters/svelte-table.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ title: Svelte Table
44

55
The `@tanstack/svelte-table` adapter is a wrapper around the core table logic. Most of it's job is related to managing state the "svelte" way, providing types and the rendering implementation of cell/header/footer templates.
66

7-
## `createTableInstance`
7+
## `createSvelteTable`
88

9-
Takes a `table` and `options` object and returns a table instance.
9+
Takes a `table` and `options` object and returns a table.
1010

1111
```tsx
12-
import { createTable, createTableInstance } from '@tanstack/svelte-table'
13-
14-
const table = createTable()
12+
import { createSvelteTable } from '@tanstack/svelte-table'
1513

1614
function App() {
17-
const instance = createTableInstance(table, options)
15+
const table = createSvelteTable(options)
1816

1917
// ...render your table
2018
}

docs/adapters/vue-table.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ title: Vue Table
44

55
The `@tanstack/vue-table` adapter is a wrapper around the core table logic. Most of it's job is related to managing state the "vue" way, providing types and the rendering implementation of cell/header/footer templates.
66

7-
## `useTableInstance`
7+
## `useVueTable`
88

9-
Takes a `table` and `options` object and returns a table instance.
9+
Takes a `table` and `options` object and returns a table.
1010

1111
```tsx
12-
import { createTable, useTableInstance } from '@tanstack/vue-table'
13-
14-
const table = createTable()
12+
import { useVueTable } from '@tanstack/vue-table'
1513

1614
function App() {
17-
const instance = useTableInstance(table, options)
15+
const table = useVueTable(options)
1816

1917
// ...render your table
2018
}

docs/api/core/Cell.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,36 @@ All cell objects have the following properties:
1414
id: string
1515
```
1616

17-
The unique ID for the cell across the entire table instance.
17+
The unique ID for the cell across the entire table.
1818

1919
### `getValue`
2020

2121
```tsx
22-
getValue: () => TGenerics['Value']
22+
getValue: () => any
2323
```
2424

2525
Returns the value for the cell, accessed via the associated column's accessor key or accessor function.
2626

2727
### `row`
2828

2929
```tsx
30-
row: Row<TGenerics>
30+
row: Row<TData>
3131
```
3232

3333
The associated Row object for the cell.
3434

3535
### `column`
3636

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

4141
The associated Column object for the cell.
4242

4343
### `renderCell`
4444

4545
```tsx
46-
renderCell: () => string | null | TGenerics['Rendered']
46+
renderCell: () => unknown
4747
```
4848

4949
Returns the rendered cell value using the associated column's `cell` template. The exact return type of this function depends on the adapter being used.

docs/api/core/Column.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,55 +31,47 @@ The depth of the column (if grouped) relative to the root column def array.
3131
### `accessorFn`
3232

3333
```tsx
34-
accessorFn?: AccessorFn<TGenerics['Row']>
34+
accessorFn?: AccessorFn<TData>
3535
```
3636

3737
The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined.
3838

3939
### `columnDef`
4040

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

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

47-
### `columnDefType`
48-
49-
```tsx
50-
columnDefType: 'data' | 'display' | 'group'
51-
```
52-
53-
The type of column def that was used to create the column. See the [`createTable()` API](../guide/tables.md#createtable) for more information.
54-
5547
### `columns`
5648

5749
```tsx
58-
type columns = ColumnDef<TGenerics>[]
50+
type columns = ColumnDef<TData>[]
5951
```
6052
6153
The child column (if the column is a group column). Will be an empty array if the column is not a group column.
6254
6355
### `parent`
6456
6557
```tsx
66-
parent?: Column<TGenerics>
58+
parent?: Column<TData>
6759
```
6860
6961
The parent column for this column. Will be undefined if this is a root column.
7062
7163
### `getFlatColumns`
7264
7365
```tsx
74-
type getFlatColumns = () => Column<TGenerics>[]
66+
type getFlatColumns = () => Column<TData>[]
7567
```
7668
7769
Returns the flattened array of this column and all child/grand-child columns for this column.
7870
7971
### `getLeafColumns`
8072
8173
```tsx
82-
type getLeafColumns = () => Column<TGenerics>[]
74+
type getLeafColumns = () => Column<TData>[]
8375
```
8476
8577
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.md

Lines changed: 6 additions & 8 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<TGenerics>
38+
column: Column<TData>
3939
```
4040

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

4343
### `headerGroup`
4444

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

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

5151
### `subHeaders`
5252

5353
```tsx
54-
type subHeaders = Header<TGenerics>[]
54+
type subHeaders = Header<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<TGenerics>[]
78+
type getLeafHeaders = () => Header<TData>[]
7979
```
8080
8181
Returns the leaf headers hierarchically nested under this header.
@@ -99,17 +99,15 @@ If the header is a placeholder header, this will be a unique header ID that does
9999
### `renderHeader`
100100
101101
```tsx
102-
renderHeader: (options?: { renderPlaceholder?: boolean }) =>
103-
string | null | TGenerics['Rendered']
102+
renderHeader: (options?: { renderPlaceholder?: boolean }) => unknown
104103
```
105104
106105
Returns the rendered header using the associated column's `header` template. The exact return type of this function depends on the adapter being used.
107106
108107
### `renderFooter`
109108
110109
```tsx
111-
renderFooter: (options?: { renderPlaceholder?: boolean }) =>
112-
string | null | TGenerics['Rendered']
110+
renderFooter: (options?: { renderPlaceholder?: boolean }) => unknown
113111
```
114112
115113
Returns the rendered footer using the associated column's `footer` template. The exact return type of this function depends on the adapter being used.

docs/api/core/Row.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ All row objects have the following properties:
1414
id: string
1515
```
1616

17-
The resolved unique identifier for the row resolved via the `instanceOptions.getRowId` option. Defaults to the row's index (or relative index if it is a subRow)
17+
The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow)
1818

1919
### `depth`
2020

@@ -35,10 +35,10 @@ The index of the row within its parent array (or the root data array)
3535
### `original`
3636

3737
```tsx
38-
original?: TGenerics['Row']
38+
original?: TData
3939
```
4040

41-
The original row object provided to the table instance
41+
The original row object provided to the table
4242

4343
### `getValue`
4444

@@ -51,31 +51,31 @@ Returns the value from the row for a given columnId
5151
### `subRows`
5252

5353
```tsx
54-
type subRows = Row<TGenerics>[]
54+
type subRows = Row<TData>[]
5555
```
5656
57-
An array of subRows for the row as returned and created by the `instanceOptions.getSubRows` option.
57+
An array of subRows for the row as returned and created by the `options.getSubRows` option.
5858
5959
### `getLeafRows`
6060
6161
```tsx
62-
type getLeafRows = () => Row<TGenerics>[]
62+
type getLeafRows = () => Row<TData>[]
6363
```
6464
6565
Returns the leaf rows for the row, not including any parent rows.
6666
6767
### `originalSubRows`
6868
6969
```tsx
70-
originalSubRows?: TGenerics['Row'][]
70+
originalSubRows?: TData[]
7171
```
7272
73-
An array of the original subRows as returned by the `instanceOptions.getSubRows` option.
73+
An array of the original subRows as returned by the `options.getSubRows` option.
7474
7575
### `getAllCells`
7676
7777
```tsx
78-
type getAllCells = () => Cell<TGenerics>[]
78+
type getAllCells = () => Cell<TData>[]
7979
```
8080
8181
Returns all of the [Cells](./Cell.md) for the row.

0 commit comments

Comments
 (0)