@@ -30,7 +30,7 @@ import type {
3030 TableOptions ,
3131 TableState ,
3232} from '@tanstack/table-core'
33- import type { Type } from '@angular/core'
33+ import type { Signal , Type } from '@angular/core'
3434
3535type RenderableComponent =
3636 | Type < any >
@@ -247,7 +247,20 @@ export type AppAngularTable<
247247 TTableComponents extends Record < string , RenderableComponent > ,
248248 TCellComponents extends Record < string , RenderableComponent > ,
249249 THeaderComponents extends Record < string , RenderableComponent > ,
250- > = AngularTable < TFeatures , TData , TSelected > & NoInfer < TTableComponents >
250+ > = AngularTable < TFeatures , TData , TSelected > &
251+ NoInfer < TTableComponents > & {
252+ appCell : < TValue > (
253+ cell : Cell < TFeatures , TData , TValue > ,
254+ ) => Cell < TFeatures , TData , TValue > & NoInfer < TCellComponents >
255+
256+ appHeader : < TValue > (
257+ header : Header < TFeatures , TData , TValue > ,
258+ ) => Header < TFeatures , TData , TValue > & NoInfer < THeaderComponents >
259+
260+ appFooter : < TValue > (
261+ footer : Header < TFeatures , TData , TValue > ,
262+ ) => Header < TFeatures , TData , TValue > & NoInfer < THeaderComponents >
263+ }
251264
252265// =============================================================================
253266// CreateTableHook Options and Props
@@ -305,7 +318,9 @@ export function createTableHook<
305318 TCellComponents ,
306319 THeaderComponents
307320> ) {
308- function injectTableContext < TData extends RowData = RowData > ( ) {
321+ function injectTableContext < TData extends RowData = RowData > ( ) : Signal <
322+ AngularTable < TFeatures , TData >
323+ > {
309324 return _injectTableContext < TFeatures , TData > ( )
310325 }
311326
@@ -345,9 +360,21 @@ export function createTableHook<
345360 TCellComponents ,
346361 THeaderComponents
347362 > {
363+ function appCell ( cell : Cell < TFeatures , TData , any > ) {
364+ return cell as Cell < TFeatures , TData , any > & TCellComponents
365+ }
366+
367+ function appHeader ( header : Cell < TFeatures , TData , any > ) {
368+ return header as Cell < TFeatures , TData , any > & TCellComponents
369+ }
370+
371+ function appFooter ( footer : Cell < TFeatures , TData , any > ) {
372+ return footer as Cell < TFeatures , TData , any > & TCellComponents
373+ }
374+
348375 const appTableFeatures : TableFeature < { } > = {
349376 constructTableAPIs : ( table ) => {
350- Object . assign ( table , tableComponents )
377+ Object . assign ( table , tableComponents , { appCell , appHeader , appFooter } )
351378 } ,
352379 assignCellPrototype ( prototype ) {
353380 Object . assign ( prototype , cellComponents )
0 commit comments