Skip to content

Commit 564e6f9

Browse files
Merge
2 parents c060daf + 912426f commit 564e6f9

722 files changed

Lines changed: 18159 additions & 8734 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/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"children": [
111111
{ "label": "Table State", "to": "framework/react/guide/table-state" },
112112
{ "label": "Composable Tables (createTableHook)", "to": "framework/react/guide/composable-tables" },
113+
{ "label": "Table Context", "to": "framework/react/guide/table-context" },
113114
{ "label": "Custom Plugins", "to": "framework/react/guide/custom-features" }
114115
]
115116
},
@@ -118,6 +119,7 @@
118119
"children": [
119120
{ "label": "Table State", "to": "framework/preact/guide/table-state" },
120121
{ "label": "Composable Tables (createTableHook)", "to": "framework/preact/guide/composable-tables" },
122+
{ "label": "Table Context", "to": "framework/preact/guide/table-context" },
121123
{ "label": "Custom Plugins", "to": "framework/preact/guide/custom-features" }
122124
]
123125
},

docs/framework/angular/reference/functions/injectTable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: injectTable
99
function injectTable<TFeatures, TData>(options): AngularTable<TFeatures, TData>;
1010
```
1111

12-
Defined in: [packages/angular-table/src/injectTable.ts:101](https://github.com/TanStack/table/blob/main/packages/angular-table/src/injectTable.ts#L101)
12+
Defined in: [packages/angular-table/src/injectTable.ts:93](https://github.com/TanStack/table/blob/main/packages/angular-table/src/injectTable.ts#L93)
1313

1414
Creates and returns an Angular-reactive table instance.
1515

docs/framework/angular/reference/type-aliases/AngularTable.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,11 @@ title: AngularTable
66
# Type Alias: AngularTable\<TFeatures, TData\>
77

88
```ts
9-
type AngularTable<TFeatures, TData> = Table<TFeatures, TData> & object;
9+
type AngularTable<TFeatures, TData> = Table<TFeatures, TData>;
1010
```
1111

1212
Defined in: [packages/angular-table/src/injectTable.ts:32](https://github.com/TanStack/table/blob/main/packages/angular-table/src/injectTable.ts#L32)
1313

14-
## Type Declaration
15-
16-
### ~~store~~
17-
18-
```ts
19-
readonly store: Table<TFeatures, TData>["store"];
20-
```
21-
22-
#### Deprecated
23-
24-
Prefer `table.atoms.<slice>.get()` for template/render reads
25-
of a specific state slice, or Angular computed values around explicit
26-
selectors. `table.store.state` is a current-value snapshot and is easy to
27-
misuse in render code.
28-
2914
## Type Parameters
3015

3116
### TFeatures

docs/framework/angular/reference/type-aliases/CreateTableHookResult.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Defined in: [packages/angular-table/src/helpers/createTableHook.ts:327](https://
128128
### injectTableCellContext()
129129

130130
```ts
131-
injectTableCellContext: <TValue, TRowData>() => Signal<Cell<TFeatures, TRowData, TValue>>;
131+
injectTableCellContext: <TValue, TRowData>() => Signal<Cell<TFeatures, TRowData, TValue> & TCellComponents>;
132132
```
133133

134134
Defined in: [packages/angular-table/src/helpers/createTableHook.ts:323](https://github.com/TanStack/table/blob/main/packages/angular-table/src/helpers/createTableHook.ts#L323)
@@ -145,14 +145,14 @@ Defined in: [packages/angular-table/src/helpers/createTableHook.ts:323](https://
145145

146146
#### Returns
147147

148-
`Signal`\<`Cell`\<`TFeatures`, `TRowData`, `TValue`\>\>
148+
`Signal`\<`Cell`\<`TFeatures`, `TRowData`, `TValue`\> & `TCellComponents`\>
149149

150150
***
151151

152152
### injectTableContext()
153153

154154
```ts
155-
injectTableContext: <TData>() => Signal<AngularTable<TFeatures, TData>>;
155+
injectTableContext: <TData>() => Signal<AngularTable<TFeatures, TData> & TTableComponents>;
156156
```
157157

158158
Defined in: [packages/angular-table/src/helpers/createTableHook.ts:316](https://github.com/TanStack/table/blob/main/packages/angular-table/src/helpers/createTableHook.ts#L316)
@@ -165,14 +165,14 @@ Defined in: [packages/angular-table/src/helpers/createTableHook.ts:316](https://
165165

166166
#### Returns
167167

168-
`Signal`\<[`AngularTable`](AngularTable.md)\<`TFeatures`, `TData`\>\>
168+
`Signal`\<[`AngularTable`](AngularTable.md)\<`TFeatures`, `TData`\> & `TTableComponents`\>
169169

170170
***
171171

172172
### injectTableHeaderContext()
173173

174174
```ts
175-
injectTableHeaderContext: <TValue, TRowData>() => Signal<Header<TFeatures, TRowData, TValue>>;
175+
injectTableHeaderContext: <TValue, TRowData>() => Signal<Header<TFeatures, TRowData, TValue> & THeaderComponents>;
176176
```
177177

178178
Defined in: [packages/angular-table/src/helpers/createTableHook.ts:319](https://github.com/TanStack/table/blob/main/packages/angular-table/src/helpers/createTableHook.ts#L319)
@@ -189,4 +189,4 @@ Defined in: [packages/angular-table/src/helpers/createTableHook.ts:319](https://
189189

190190
#### Returns
191191

192-
`Signal`\<`Header`\<`TFeatures`, `TRowData`, `TValue`\>\>
192+
`Signal`\<`Header`\<`TFeatures`, `TRowData`, `TValue`\> & `THeaderComponents`\>

docs/framework/lit/reference/functions/createTableHook.md

Lines changed: 3 additions & 243 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ title: createTableHook
66
# Function: createTableHook()
77

88
```ts
9-
function createTableHook<TFeatures, TTableComponents, TCellComponents, THeaderComponents>(__namedParameters): object;
9+
function createTableHook<TFeatures, TTableComponents, TCellComponents, THeaderComponents>(__namedParameters): CreateTableHookResult<TFeatures, TTableComponents, TCellComponents, THeaderComponents>;
1010
```
1111

12-
Defined in: [createTableHook.ts:427](https://github.com/TanStack/table/blob/main/packages/lit-table/src/createTableHook.ts#L427)
12+
Defined in: [createTableHook.ts:503](https://github.com/TanStack/table/blob/main/packages/lit-table/src/createTableHook.ts#L503)
1313

1414
Creates a custom table hook with pre-bound components for composition.
1515

@@ -46,247 +46,7 @@ This is the table equivalent of TanStack Form's `createFormHook`. It allows you
4646

4747
## Returns
4848

49-
### appFeatures
50-
51-
```ts
52-
appFeatures: TFeatures;
53-
```
54-
55-
### createAppColumnHelper()
56-
57-
```ts
58-
createAppColumnHelper: <TData>() => AppColumnHelper<TFeatures, TData, TCellComponents, THeaderComponents>;
59-
```
60-
61-
Create a column helper pre-bound to the features and components configured in this table hook.
62-
The cell, header, and footer contexts include pre-bound components (e.g., `cell.TextCell`).
63-
64-
#### Type Parameters
65-
66-
##### TData
67-
68-
`TData` *extends* `RowData`
69-
70-
#### Returns
71-
72-
[`AppColumnHelper`](../type-aliases/AppColumnHelper.md)\<`TFeatures`, `TData`, `TCellComponents`, `THeaderComponents`\>
73-
74-
#### Example
75-
76-
```ts
77-
const columnHelper = createAppColumnHelper<Person>()
78-
79-
const columns = [
80-
columnHelper.accessor('firstName', {
81-
header: 'First Name',
82-
cell: ({ cell }) => cell.FlexRender(), // cell has pre-bound components!
83-
}),
84-
columnHelper.accessor('age', {
85-
header: 'Age',
86-
cell: ({ cell }) => cell.NumberCell(),
87-
}),
88-
]
89-
```
90-
91-
### useAppTable()
92-
93-
```ts
94-
useAppTable: <TData, TSelected>(host, tableOptions, selector?) => object;
95-
```
96-
97-
Enhanced table hook that returns a controller-like object with a `table()` method.
98-
The returned table has App wrapper functions and pre-bound tableComponents
99-
attached directly to the table object.
100-
101-
Default options from createTableHook are automatically merged with
102-
the options passed here. Options passed here take precedence.
103-
104-
TFeatures is already known from the createTableHook call; TData is inferred from the data prop.
105-
106-
#### Type Parameters
107-
108-
##### TData
109-
110-
`TData` *extends* `RowData`
111-
112-
##### TSelected
113-
114-
`TSelected` = `TableState`\<`TFeatures`\>
115-
116-
#### Parameters
117-
118-
##### host
119-
120-
`ReactiveControllerHost` & `HTMLElement`
121-
122-
##### tableOptions
123-
124-
`Omit`\<`TableOptions`\<`TFeatures`, `TData`\>, `"features"`\>
125-
126-
##### selector?
127-
128-
(`state`) => `TSelected`
129-
130-
#### Returns
131-
132-
`object`
133-
134-
##### table()
135-
136-
```ts
137-
table: () => AppLitTable<TFeatures, TData, TSelected, TTableComponents, TCellComponents, THeaderComponents>;
138-
```
139-
140-
###### Returns
141-
142-
[`AppLitTable`](../type-aliases/AppLitTable.md)\<`TFeatures`, `TData`, `TSelected`, `TTableComponents`, `TCellComponents`, `THeaderComponents`\>
143-
144-
#### Example
145-
146-
```ts
147-
@customElement('my-table')
148-
class MyTable extends LitElement {
149-
private appTable = useAppTable(this, {
150-
columns,
151-
data: this.data,
152-
})
153-
154-
protected render() {
155-
const table = this.appTable.table()
156-
return html`...`
157-
}
158-
}
159-
```
160-
161-
### useCellContext()
162-
163-
```ts
164-
useCellContext: <TValue>(host) => ContextConsumer<Context<symbol, Cell<TFeatures, any, TValue>>, ReactiveControllerHost & HTMLElement>;
165-
```
166-
167-
Access the cell instance from within a custom element that is a descendant
168-
of an element providing cell context.
169-
Uses `@lit/context` ContextConsumer to retrieve the cell.
170-
TFeatures is already known from the createTableHook call.
171-
172-
#### Type Parameters
173-
174-
##### TValue
175-
176-
`TValue` *extends* `unknown` = `unknown`
177-
178-
#### Parameters
179-
180-
##### host
181-
182-
`ReactiveControllerHost` & `HTMLElement`
183-
184-
#### Returns
185-
186-
`ContextConsumer`\<`Context`\<`symbol`, `Cell`\<`TFeatures`, `any`, `TValue`\>\>, `ReactiveControllerHost` & `HTMLElement`\>
187-
188-
#### Example
189-
190-
```ts
191-
@customElement('text-cell')
192-
class TextCell extends LitElement {
193-
private _cell = useCellContext(this)
194-
195-
protected render() {
196-
const cell = this._cell.value
197-
if (!cell) return html``
198-
return html`<span>${cell.getValue()}</span>`
199-
}
200-
}
201-
```
202-
203-
### useHeaderContext()
204-
205-
```ts
206-
useHeaderContext: <TValue>(host) => ContextConsumer<Context<symbol, Header<TFeatures, any, TValue>>, ReactiveControllerHost & HTMLElement>;
207-
```
208-
209-
Access the header instance from within a custom element that is a descendant
210-
of an element providing header context.
211-
Uses `@lit/context` ContextConsumer to retrieve the header.
212-
TFeatures is already known from the createTableHook call.
213-
214-
#### Type Parameters
215-
216-
##### TValue
217-
218-
`TValue` *extends* `unknown` = `unknown`
219-
220-
#### Parameters
221-
222-
##### host
223-
224-
`ReactiveControllerHost` & `HTMLElement`
225-
226-
#### Returns
227-
228-
`ContextConsumer`\<`Context`\<`symbol`, `Header`\<`TFeatures`, `any`, `TValue`\>\>, `ReactiveControllerHost` & `HTMLElement`\>
229-
230-
#### Example
231-
232-
```ts
233-
@customElement('sort-indicator')
234-
class SortIndicator extends LitElement {
235-
private _header = useHeaderContext(this)
236-
237-
protected render() {
238-
const header = this._header.value
239-
if (!header) return html``
240-
const sorted = header.column.getIsSorted()
241-
return html`${sorted === 'asc' ? '🔼' : sorted === 'desc' ? '🔽' : ''}`
242-
}
243-
}
244-
```
245-
246-
### useTableContext()
247-
248-
```ts
249-
useTableContext: <TData>(host) => ContextConsumer<Context<symbol, LitTable<TFeatures, TData, any>>, ReactiveControllerHost & HTMLElement>;
250-
```
251-
252-
Access the table instance from within a custom element that is a descendant
253-
of the element using `useAppTable`.
254-
Uses `@lit/context` ContextConsumer to retrieve the table from the nearest ancestor provider.
255-
TFeatures is already known from the createTableHook call.
256-
257-
#### Type Parameters
258-
259-
##### TData
260-
261-
`TData` *extends* `RowData` = `RowData`
262-
263-
#### Parameters
264-
265-
##### host
266-
267-
`ReactiveControllerHost` & `HTMLElement`
268-
269-
#### Returns
270-
271-
`ContextConsumer`\<`Context`\<`symbol`, [`LitTable`](../type-aliases/LitTable.md)\<`TFeatures`, `TData`, `any`\>\>, `ReactiveControllerHost` & `HTMLElement`\>
272-
273-
#### Example
274-
275-
```ts
276-
@customElement('pagination-controls')
277-
class PaginationControls extends LitElement {
278-
private _table = useTableContext(this)
279-
280-
protected render() {
281-
const table = this._table.value
282-
if (!table) return html``
283-
return html`
284-
<button @click=${() => table.previousPage()}>Prev</button>
285-
<button @click=${() => table.nextPage()}>Next</button>
286-
`
287-
}
288-
}
289-
```
49+
[`CreateTableHookResult`](../interfaces/CreateTableHookResult.md)\<`TFeatures`, `TTableComponents`, `TCellComponents`, `THeaderComponents`\>
29050

29151
## Example
29252

docs/framework/lit/reference/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ title: "@tanstack/lit-table"
99

1010
- [TableController](classes/TableController.md)
1111

12+
## Interfaces
13+
14+
- [CreateTableHookResult](interfaces/CreateTableHookResult.md)
15+
1216
## Type Aliases
1317

1418
- [AppCellContext](type-aliases/AppCellContext.md)
@@ -19,6 +23,7 @@ title: "@tanstack/lit-table"
1923
- [AppGroupColumnDef](type-aliases/AppGroupColumnDef.md)
2024
- [AppHeaderContext](type-aliases/AppHeaderContext.md)
2125
- [AppLitTable](type-aliases/AppLitTable.md)
26+
- [BoundComponents](type-aliases/BoundComponents.md)
2227
- [ComponentType](type-aliases/ComponentType.md)
2328
- [CreateTableHookOptions](type-aliases/CreateTableHookOptions.md)
2429
- [FlexRenderProps](type-aliases/FlexRenderProps.md)

0 commit comments

Comments
 (0)