@@ -57,7 +57,7 @@ import {
57
57
} from 'rxjs' ;
58
58
import { takeUntil } from 'rxjs/operators' ;
59
59
import { CdkColumnDef } from './cell' ;
60
- import { _CoalescedStyleScheduler } from './coalesced-style-scheduler' ;
60
+ import { _CoalescedStyleScheduler , _COALESCED_STYLE_SCHEDULER } from './coalesced-style-scheduler' ;
61
61
import {
62
62
BaseRowDef ,
63
63
CdkCellOutlet ,
@@ -199,7 +199,7 @@ export interface RenderRow<T> {
199
199
providers : [
200
200
{ provide : CDK_TABLE , useExisting : CdkTable } ,
201
201
{ provide : _VIEW_REPEATER_STRATEGY , useClass : _DisposeViewRepeaterStrategy } ,
202
- _CoalescedStyleScheduler ,
202
+ { provide : _COALESCED_STYLE_SCHEDULER , useClass : _CoalescedStyleScheduler } ,
203
203
]
204
204
} )
205
205
export class CdkTable < T > implements AfterContentChecked , CollectionViewer , OnDestroy , OnInit {
@@ -443,14 +443,19 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
443
443
constructor (
444
444
protected readonly _differs : IterableDiffers ,
445
445
protected readonly _changeDetectorRef : ChangeDetectorRef ,
446
- protected readonly _coalescedStyleScheduler : _CoalescedStyleScheduler ,
447
446
protected readonly _elementRef : ElementRef , @Attribute ( 'role' ) role : string ,
448
447
@Optional ( ) protected readonly _dir : Directionality , @Inject ( DOCUMENT ) _document : any ,
449
448
private _platform : Platform ,
450
- // Optional for backwards compatibility, but a view repeater strategy will always
451
- // be provided.
449
+
450
+ /**
451
+ * @deprecated `_coalescedStyleScheduler`, `_viewRepeater` and `_viewportRuler`
452
+ * parameters to become required.
453
+ * @breaking -change 11.0.0
454
+ */
452
455
@Optional ( ) @Inject ( _VIEW_REPEATER_STRATEGY )
453
- protected readonly _viewRepeater : _ViewRepeater < T , RenderRow < T > , RowContext < T > > ) {
456
+ protected readonly _viewRepeater ?: _ViewRepeater < T , RenderRow < T > , RowContext < T > > ,
457
+ @Optional ( ) @Inject ( _COALESCED_STYLE_SCHEDULER )
458
+ protected readonly _coalescedStyleScheduler ?: _CoalescedStyleScheduler ) {
454
459
if ( ! role ) {
455
460
this . _elementRef . nativeElement . setAttribute ( 'role' , 'grid' ) ;
456
461
}
@@ -549,11 +554,14 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
549
554
return ;
550
555
}
551
556
const viewContainer = this . _rowOutlet . viewContainer ;
552
- this . _viewRepeater . applyChanges (
557
+
558
+ // @breaking -change 11.0.0 Remove null check for `_viewRepeater`
559
+ // once it's a required parameter in the constructor.
560
+ this . _viewRepeater ?. applyChanges (
553
561
changes ,
554
562
viewContainer ,
555
563
( record : IterableChangeRecord < RenderRow < T > > ,
556
- adjustedPreviousIndex : number | null ,
564
+ _adjustedPreviousIndex : number | null ,
557
565
currentIndex : number | null ) => this . _getEmbeddedViewArgs ( record . item , currentIndex ! ) ,
558
566
( record ) => record . item . data ,
559
567
( change : _ViewRepeaterItemChange < RenderRow < T > , RowContext < T > > ) => {
0 commit comments