@@ -19,9 +19,9 @@ import {
1919 * A {@link _TableLayoutStrategy} that enables scrollable body content for flex tables.
2020 */
2121@Injectable ( )
22- class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
22+ export class ScrollableTableBodyLayoutStrategy < T > implements _TableLayoutStrategy < T > {
2323 private readonly _document : Document ;
24- private defaultLayout : _StandardTableLayoutStrategy ;
24+ private defaultLayout : _StandardTableLayoutStrategy < T > ;
2525 private _pendingMaxHeight = 'none' ;
2626 private _scrollViewport ?: HTMLElement ;
2727 readonly headerCssClass = 'cdk-table-scrollable-table-header' ;
@@ -37,7 +37,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
3737 * Returns the DOM structure for a native table. Scrollable body content is not supported for
3838 * native tables. Return `null` to use the default {@link CdkTable} native table layout.
3939 */
40- getNativeLayout ( table : CdkTable < unknown > ) : DocumentFragment {
40+ getNativeLayout ( table : CdkTable < T > ) : DocumentFragment {
4141 return this . defaultLayout . getNativeLayout ( table ) ;
4242 }
4343
@@ -46,7 +46,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
4646 * (header, body, footer) is wrapped in a separate container. The specified max height is applied
4747 * to the body row outlet to make its content scrollable.
4848 */
49- getFlexLayout ( table : CdkTable < unknown > ) : DocumentFragment {
49+ getFlexLayout ( table : CdkTable < T > ) : DocumentFragment {
5050 const documentFragment = this . _document . createDocumentFragment ( ) ;
5151 const sections = [
5252 { cssClass : this . headerCssClass , outlets : [ table . _headerRowOutlet ] } ,
@@ -64,7 +64,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
6464 documentFragment . appendChild ( element ) ;
6565 }
6666
67- this . _scrollViewport = documentFragment . querySelector ( `.${ this . bodyCssClass } ` ) ;
67+ this . _scrollViewport = documentFragment . querySelector ( `.${ this . bodyCssClass } ` ) as HTMLElement ;
6868 this . _scrollViewport ! . style . overflow = 'auto' ;
6969 this . _applyMaxHeight ( this . _scrollViewport ! , this . _pendingMaxHeight ) ;
7070
@@ -94,7 +94,7 @@ class ScrollableTableBodyLayoutStrategy implements _TableLayoutStrategy {
9494 { provide : _TABLE_LAYOUT_STRATEGY , useClass : ScrollableTableBodyLayoutStrategy } ,
9595 ]
9696} )
97- export class CdkScrollableTableBody {
97+ export class CdkScrollableTableBody < T > {
9898 /**
9999 * Show a scroll bar if the table's body exceeds this height. The height may be specified with
100100 * any valid CSS unit of measurement.
@@ -110,6 +110,6 @@ export class CdkScrollableTableBody {
110110 private _maxHeight = '' ;
111111
112112 constructor ( @Inject ( _TABLE_LAYOUT_STRATEGY )
113- private readonly _layoutStrategy : ScrollableTableBodyLayoutStrategy ) {
113+ private readonly _layoutStrategy : ScrollableTableBodyLayoutStrategy < T > ) {
114114 }
115115}
0 commit comments