@@ -19,9 +19,9 @@ import {
19
19
* A {@link _TableLayoutStrategy} that enables scrollable body content for flex tables.
20
20
*/
21
21
@Injectable ( )
22
- class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
22
+ export class ScrollableTableBodyLayoutStrategy < T > implements _TableLayoutStrategy < T > {
23
23
private readonly _document : Document ;
24
- private defaultLayout : _StandardTableLayoutStrategy ;
24
+ private defaultLayout : _StandardTableLayoutStrategy < T > ;
25
25
private _pendingMaxHeight = 'none' ;
26
26
private _scrollViewport ?: HTMLElement ;
27
27
readonly headerCssClass = 'cdk-table-scrollable-table-header' ;
@@ -37,7 +37,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
37
37
* Returns the DOM structure for a native table. Scrollable body content is not supported for
38
38
* native tables. Return `null` to use the default {@link CdkTable} native table layout.
39
39
*/
40
- getNativeLayout ( table : CdkTable < unknown > ) : DocumentFragment {
40
+ getNativeLayout ( table : CdkTable < T > ) : DocumentFragment {
41
41
return this . defaultLayout . getNativeLayout ( table ) ;
42
42
}
43
43
@@ -46,7 +46,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
46
46
* (header, body, footer) is wrapped in a separate container. The specified max height is applied
47
47
* to the body row outlet to make its content scrollable.
48
48
*/
49
- getFlexLayout ( table : CdkTable < unknown > ) : DocumentFragment {
49
+ getFlexLayout ( table : CdkTable < T > ) : DocumentFragment {
50
50
const documentFragment = this . _document . createDocumentFragment ( ) ;
51
51
const sections = [
52
52
{ cssClass : this . headerCssClass , outlets : [ table . _headerRowOutlet ] } ,
@@ -64,7 +64,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
64
64
documentFragment . appendChild ( element ) ;
65
65
}
66
66
67
- this . _scrollViewport = documentFragment . querySelector ( `.${ this . bodyCssClass } ` ) ;
67
+ this . _scrollViewport = documentFragment . querySelector ( `.${ this . bodyCssClass } ` ) as HTMLElement ;
68
68
this . _scrollViewport ! . style . overflow = 'auto' ;
69
69
this . _applyMaxHeight ( this . _scrollViewport ! , this . _pendingMaxHeight ) ;
70
70
@@ -94,7 +94,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
94
94
{ provide : _TABLE_LAYOUT_STRATEGY , useClass : ScrollableTableBodyLayoutStrategy } ,
95
95
]
96
96
} )
97
- export class CdkScrollableTableBody {
97
+ export class CdkScrollableTableBody < T > {
98
98
/**
99
99
* Show a scroll bar if the table's body exceeds this height. The height may be specified with
100
100
* any valid CSS unit of measurement.
@@ -110,6 +110,6 @@ export class CdkScrollableTableBody {
110
110
private _maxHeight = '' ;
111
111
112
112
constructor ( @Inject ( _TABLE_LAYOUT_STRATEGY )
113
- private readonly _layoutStrategy : ScrollableTableBodyLayoutStrategy ) {
113
+ private readonly _layoutStrategy : ScrollableTableBodyLayoutStrategy < T > ) {
114
114
}
115
115
}
0 commit comments