Skip to content

Commit

Permalink
compat(table): add mat-compatible rows (#6603)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewseguin authored and kara committed Aug 23, 2017
1 parent c4a5d7a commit 32f42d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/lib/table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {NgModule} from '@angular/core';
import {MdTable} from './table';
import {CdkTableModule} from '@angular/cdk/table';
import {MdCell, MdHeaderCell, MdCellDef, MdHeaderCellDef, MdColumnDef} from './cell';
import {MdHeaderRow, MdRow, MdHeaderRowDef, MdRowDef} from './row';
import {MdHeaderRow, MdRow, MdHeaderRowDef, MdRowDef, MatHeaderRowDef, MatRowDef} from './row';
import {CommonModule} from '@angular/common';
import {MdCommonModule} from '../core';

Expand All @@ -22,9 +22,11 @@ export * from './row';
imports: [CdkTableModule, CommonModule, MdCommonModule],
exports: [MdTable, MdCellDef, MdHeaderCellDef, MdColumnDef,
MdHeaderRowDef, MdRowDef,
MdHeaderCell, MdCell, MdHeaderRow, MdRow],
MdHeaderCell, MdCell, MdHeaderRow, MdRow,
MatHeaderRowDef, MatRowDef],
declarations: [MdTable, MdCellDef, MdHeaderCellDef, MdColumnDef,
MdHeaderRowDef, MdRowDef,
MdHeaderCell, MdCell, MdHeaderRow, MdRow],
MdHeaderCell, MdCell, MdHeaderRow, MdRow,
MatHeaderRowDef, MatRowDef],
})
export class MdTableModule {}
20 changes: 18 additions & 2 deletions src/lib/table/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,39 @@ export const _MdRow = CdkRow;
* Captures the header row's template and other header properties such as the columns to display.
*/
@Directive({
selector: '[mdHeaderRowDef], [matHeaderRowDef]',
selector: '[mdHeaderRowDef]',
providers: [{provide: CdkHeaderRowDef, useExisting: MdHeaderRowDef}],
inputs: ['columns: mdHeaderRowDef'],
})
export class MdHeaderRowDef extends _MdHeaderRowDef { }

/** Mat-compatible version of MdHeaderRowDef */
@Directive({
selector: '[matHeaderRowDef]',
providers: [{provide: CdkHeaderRowDef, useExisting: MatHeaderRowDef}],
inputs: ['columns: matHeaderRowDef'],
})
export class MatHeaderRowDef extends _MdHeaderRowDef { }

/**
* Data row definition for the md-table.
* Captures the header row's template and other row properties such as the columns to display.
*/
@Directive({
selector: '[mdRowDef], [matRowDef]',
selector: '[mdRowDef]',
providers: [{provide: CdkRowDef, useExisting: MdRowDef}],
inputs: ['columns: mdRowDefColumns'],
})
export class MdRowDef extends _MdCdkRowDef { }

/** Mat-compatible version of MdRowDef */
@Directive({
selector: '[matRowDef]',
providers: [{provide: CdkRowDef, useExisting: MatRowDef}],
inputs: ['columns: matRowDefColumns'],
})
export class MatRowDef extends _MdCdkRowDef { }

/** Header template container that contains the cell outlet. Adds the right class and role. */
@Component({
selector: 'md-header-row, mat-header-row',
Expand Down

0 comments on commit 32f42d6

Please sign in to comment.