Skip to content

Commit 848fe58

Browse files
authored
build(table): explicitly define MatTable ctor (#10982)
* build(table): explicitly define MatTable ctor * update ctor to constructor
1 parent 2046b7a commit 848fe58

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/cdk/table/table.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import {
2323
IterableDiffer,
2424
IterableDiffers,
2525
OnInit,
26-
QueryList, TemplateRef,
26+
QueryList,
27+
TemplateRef,
2728
TrackByFunction,
2829
ViewChild,
2930
ViewContainerRef,
@@ -39,7 +40,7 @@ import {
3940
CdkRowDef
4041
} from './row';
4142
import {takeUntil} from 'rxjs/operators';
42-
import {of as observableOf, BehaviorSubject, Observable, Subscription, Subject} from 'rxjs';
43+
import {BehaviorSubject, Observable, of as observableOf, Subject, Subscription} from 'rxjs';
4344
import {CdkColumnDef} from './cell';
4445
import {
4546
getTableDuplicateColumnNameError,
@@ -248,9 +249,9 @@ export class CdkTable<T> implements CollectionViewer, OnInit, AfterContentChecke
248249
*/
249250
@ContentChild(CdkFooterRowDef) _footerRowDef: CdkFooterRowDef;
250251

251-
constructor(private readonly _differs: IterableDiffers,
252-
private readonly _changeDetectorRef: ChangeDetectorRef,
253-
private readonly _elementRef: ElementRef,
252+
constructor(protected readonly _differs: IterableDiffers,
253+
protected readonly _changeDetectorRef: ChangeDetectorRef,
254+
protected readonly _elementRef: ElementRef,
254255
@Attribute('role') role: string) {
255256
if (!role) {
256257
this._elementRef.nativeElement.setAttribute('role', 'grid');

src/lib/table/table.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
9+
import {
10+
Attribute,
11+
ChangeDetectionStrategy,
12+
ChangeDetectorRef,
13+
Component,
14+
ElementRef,
15+
IterableDiffers,
16+
ViewEncapsulation
17+
} from '@angular/core';
1018
import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table';
1119

1220
/**
@@ -24,4 +32,16 @@ import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table';
2432
encapsulation: ViewEncapsulation.None,
2533
changeDetection: ChangeDetectionStrategy.OnPush,
2634
})
27-
export class MatTable<T> extends CdkTable<T> { }
35+
export class MatTable<T> extends CdkTable<T> {
36+
// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
37+
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
38+
// fixed bug.
39+
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
40+
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
41+
constructor(protected _differs: IterableDiffers,
42+
protected _changeDetectorRef: ChangeDetectorRef,
43+
protected _elementRef: ElementRef,
44+
@Attribute('role') role: string) {
45+
super(_differs, _changeDetectorRef, _elementRef, role);
46+
}
47+
}

0 commit comments

Comments
 (0)