From 848fe58980d4e1d0e9d26508c9158cdd4da53437 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Wed, 25 Apr 2018 09:57:57 -0700 Subject: [PATCH] build(table): explicitly define MatTable ctor (#10982) * build(table): explicitly define MatTable ctor * update ctor to constructor --- src/cdk/table/table.ts | 11 ++++++----- src/lib/table/table.ts | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/cdk/table/table.ts b/src/cdk/table/table.ts index e6845a3567c..87a13de66c2 100644 --- a/src/cdk/table/table.ts +++ b/src/cdk/table/table.ts @@ -23,7 +23,8 @@ import { IterableDiffer, IterableDiffers, OnInit, - QueryList, TemplateRef, + QueryList, + TemplateRef, TrackByFunction, ViewChild, ViewContainerRef, @@ -39,7 +40,7 @@ import { CdkRowDef } from './row'; import {takeUntil} from 'rxjs/operators'; -import {of as observableOf, BehaviorSubject, Observable, Subscription, Subject} from 'rxjs'; +import {BehaviorSubject, Observable, of as observableOf, Subject, Subscription} from 'rxjs'; import {CdkColumnDef} from './cell'; import { getTableDuplicateColumnNameError, @@ -248,9 +249,9 @@ export class CdkTable implements CollectionViewer, OnInit, AfterContentChecke */ @ContentChild(CdkFooterRowDef) _footerRowDef: CdkFooterRowDef; - constructor(private readonly _differs: IterableDiffers, - private readonly _changeDetectorRef: ChangeDetectorRef, - private readonly _elementRef: ElementRef, + constructor(protected readonly _differs: IterableDiffers, + protected readonly _changeDetectorRef: ChangeDetectorRef, + protected readonly _elementRef: ElementRef, @Attribute('role') role: string) { if (!role) { this._elementRef.nativeElement.setAttribute('role', 'grid'); diff --git a/src/lib/table/table.ts b/src/lib/table/table.ts index 49371dbc285..af2be413587 100644 --- a/src/lib/table/table.ts +++ b/src/lib/table/table.ts @@ -6,7 +6,15 @@ * found in the LICENSE file at https://angular.io/license */ -import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; +import { + Attribute, + ChangeDetectionStrategy, + ChangeDetectorRef, + Component, + ElementRef, + IterableDiffers, + ViewEncapsulation +} from '@angular/core'; import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table'; /** @@ -24,4 +32,16 @@ import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table'; encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, }) -export class MatTable extends CdkTable { } +export class MatTable extends CdkTable { + // TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to + // properly build the es6 version of the class. Currently sets ctorParameters to empty due to a + // fixed bug. + // https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this + // https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version + constructor(protected _differs: IterableDiffers, + protected _changeDetectorRef: ChangeDetectorRef, + protected _elementRef: ElementRef, + @Attribute('role') role: string) { + super(_differs, _changeDetectorRef, _elementRef, role); + } +}