Skip to content

Commit 32f42d6

Browse files
andrewseguinkara
authored andcommitted
compat(table): add mat-compatible rows (#6603)
1 parent c4a5d7a commit 32f42d6

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/lib/table/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {NgModule} from '@angular/core';
1010
import {MdTable} from './table';
1111
import {CdkTableModule} from '@angular/cdk/table';
1212
import {MdCell, MdHeaderCell, MdCellDef, MdHeaderCellDef, MdColumnDef} from './cell';
13-
import {MdHeaderRow, MdRow, MdHeaderRowDef, MdRowDef} from './row';
13+
import {MdHeaderRow, MdRow, MdHeaderRowDef, MdRowDef, MatHeaderRowDef, MatRowDef} from './row';
1414
import {CommonModule} from '@angular/common';
1515
import {MdCommonModule} from '../core';
1616

@@ -22,9 +22,11 @@ export * from './row';
2222
imports: [CdkTableModule, CommonModule, MdCommonModule],
2323
exports: [MdTable, MdCellDef, MdHeaderCellDef, MdColumnDef,
2424
MdHeaderRowDef, MdRowDef,
25-
MdHeaderCell, MdCell, MdHeaderRow, MdRow],
25+
MdHeaderCell, MdCell, MdHeaderRow, MdRow,
26+
MatHeaderRowDef, MatRowDef],
2627
declarations: [MdTable, MdCellDef, MdHeaderCellDef, MdColumnDef,
2728
MdHeaderRowDef, MdRowDef,
28-
MdHeaderCell, MdCell, MdHeaderRow, MdRow],
29+
MdHeaderCell, MdCell, MdHeaderRow, MdRow,
30+
MatHeaderRowDef, MatRowDef],
2931
})
3032
export class MdTableModule {}

src/lib/table/row.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,39 @@ export const _MdRow = CdkRow;
2626
* Captures the header row's template and other header properties such as the columns to display.
2727
*/
2828
@Directive({
29-
selector: '[mdHeaderRowDef], [matHeaderRowDef]',
29+
selector: '[mdHeaderRowDef]',
3030
providers: [{provide: CdkHeaderRowDef, useExisting: MdHeaderRowDef}],
3131
inputs: ['columns: mdHeaderRowDef'],
3232
})
3333
export class MdHeaderRowDef extends _MdHeaderRowDef { }
3434

35+
/** Mat-compatible version of MdHeaderRowDef */
36+
@Directive({
37+
selector: '[matHeaderRowDef]',
38+
providers: [{provide: CdkHeaderRowDef, useExisting: MatHeaderRowDef}],
39+
inputs: ['columns: matHeaderRowDef'],
40+
})
41+
export class MatHeaderRowDef extends _MdHeaderRowDef { }
42+
3543
/**
3644
* Data row definition for the md-table.
3745
* Captures the header row's template and other row properties such as the columns to display.
3846
*/
3947
@Directive({
40-
selector: '[mdRowDef], [matRowDef]',
48+
selector: '[mdRowDef]',
4149
providers: [{provide: CdkRowDef, useExisting: MdRowDef}],
4250
inputs: ['columns: mdRowDefColumns'],
4351
})
4452
export class MdRowDef extends _MdCdkRowDef { }
4553

54+
/** Mat-compatible version of MdRowDef */
55+
@Directive({
56+
selector: '[matRowDef]',
57+
providers: [{provide: CdkRowDef, useExisting: MatRowDef}],
58+
inputs: ['columns: matRowDefColumns'],
59+
})
60+
export class MatRowDef extends _MdCdkRowDef { }
61+
4662
/** Header template container that contains the cell outlet. Adds the right class and role. */
4763
@Component({
4864
selector: 'md-header-row, mat-header-row',

0 commit comments

Comments
 (0)