From b7b3fd58ad22e5348b8de777428d6511db87cdd4 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Wed, 9 May 2018 15:46:57 -0700 Subject: [PATCH] fix(table): add missing constructors --- src/lib/table/cell.ts | 23 +++++++++++++++++++---- src/lib/table/row.ts | 26 +++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/lib/table/cell.ts b/src/lib/table/cell.ts index fd6a9f525a2d..b7897e5179e7 100644 --- a/src/lib/table/cell.ts +++ b/src/lib/table/cell.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Directive, ElementRef, Input} from '@angular/core'; +import {Directive, ElementRef, Input, TemplateRef} from '@angular/core'; import { CdkCell, CdkCellDef, @@ -23,7 +23,12 @@ import { selector: '[matCellDef]', providers: [{provide: CdkCellDef, useExisting: MatCellDef}] }) -export class MatCellDef extends CdkCellDef { } +export class MatCellDef extends CdkCellDef { + // TODO(andrewseguin): Remove this constructor after compiler-cli is updated; see issue #9329 + constructor(/** @docs-private */ public template: TemplateRef) { + super(template); + } +} /** * Header cell definition for the mat-table. @@ -33,7 +38,12 @@ export class MatCellDef extends CdkCellDef { } selector: '[matHeaderCellDef]', providers: [{provide: CdkHeaderCellDef, useExisting: MatHeaderCellDef}] }) -export class MatHeaderCellDef extends CdkHeaderCellDef { } +export class MatHeaderCellDef extends CdkHeaderCellDef { + // TODO(andrewseguin): Remove this constructor after compiler-cli is updated; see issue #9329 + constructor(/** @docs-private */ public template: TemplateRef) { + super(template); + } +} /** * Footer cell definition for the mat-table. @@ -43,7 +53,12 @@ export class MatHeaderCellDef extends CdkHeaderCellDef { } selector: '[matFooterCellDef]', providers: [{provide: CdkFooterCellDef, useExisting: MatFooterCellDef}] }) -export class MatFooterCellDef extends CdkFooterCellDef { } +export class MatFooterCellDef extends CdkFooterCellDef { + // TODO(andrewseguin): Remove this constructor after compiler-cli is updated; see issue #9329 + constructor(/** @docs-private */ public template: TemplateRef) { + super(template); + } +} /** * Column definition for the mat-table. diff --git a/src/lib/table/row.ts b/src/lib/table/row.ts index 7a3db6bf7bd2..1a7addbe6094 100644 --- a/src/lib/table/row.ts +++ b/src/lib/table/row.ts @@ -6,7 +6,13 @@ * found in the LICENSE file at https://angular.io/license */ -import {ChangeDetectionStrategy, Component, Directive, ViewEncapsulation} from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + Directive, + IterableDiffers, TemplateRef, + ViewEncapsulation +} from '@angular/core'; import { CDK_ROW_TEMPLATE, CdkFooterRow, CdkFooterRowDef, CdkHeaderRow, @@ -24,7 +30,12 @@ import { providers: [{provide: CdkHeaderRowDef, useExisting: MatHeaderRowDef}], inputs: ['columns: matHeaderRowDef'], }) -export class MatHeaderRowDef extends CdkHeaderRowDef { } +export class MatHeaderRowDef extends CdkHeaderRowDef { + // TODO(andrewseguin): Remove this constructor after compiler-cli is updated; see issue #9329 + constructor(template: TemplateRef, _differs: IterableDiffers) { + super(template, _differs); + } +} /** * Footer row definition for the mat-table. @@ -35,7 +46,12 @@ export class MatHeaderRowDef extends CdkHeaderRowDef { } providers: [{provide: CdkFooterRowDef, useExisting: MatFooterRowDef}], inputs: ['columns: matFooterRowDef'], }) -export class MatFooterRowDef extends CdkFooterRowDef { } +export class MatFooterRowDef extends CdkFooterRowDef { + // TODO(andrewseguin): Remove this constructor after compiler-cli is updated; see issue #9329 + constructor(template: TemplateRef, _differs: IterableDiffers) { + super(template, _differs); + } +} /** * Data row definition for the mat-table. @@ -48,6 +64,10 @@ export class MatFooterRowDef extends CdkFooterRowDef { } inputs: ['columns: matRowDefColumns', 'when: matRowDefWhen'], }) export class MatRowDef extends CdkRowDef { + // TODO(andrewseguin): Remove this constructor after compiler-cli is updated; see issue #9329 + constructor(template: TemplateRef, _differs: IterableDiffers) { + super(template, _differs); + } } /** Footer template container that contains the cell outlet. Adds the right class and role. */