Skip to content

fix(material-experimental/mdc-table): don't import template from other package #21594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/material-experimental/mdc-table/text-column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import {CdkTextColumn} from '@angular/cdk/table';
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
import {_MAT_TEXT_COLUMN_TEMPLATE} from '@angular/material/table';

/**
* Column that simply shows text content for the header and row cells. Assumes that the table
Expand All @@ -21,7 +20,16 @@ import {_MAT_TEXT_COLUMN_TEMPLATE} from '@angular/material/table';
*/
@Component({
selector: 'mat-text-column',
template: _MAT_TEXT_COLUMN_TEMPLATE,
template: `
<ng-container matColumnDef>
<th mat-header-cell *matHeaderCellDef [style.text-align]="justify">
{{headerText}}
</th>
<td mat-cell *matCellDef="let data" [style.text-align]="justify">
{{dataAccessor(data, name)}}
</td>
</ng-container>
`,
encapsulation: ViewEncapsulation.None,
// Change detection is intentionally not set to OnPush. This component's template will be provided
// to the table to be inserted into its view. This is problematic when change detection runs since
Expand Down
22 changes: 10 additions & 12 deletions src/material/table/text-column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
import {CdkTextColumn} from '@angular/cdk/table';
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';

export const _MAT_TEXT_COLUMN_TEMPLATE = `
<ng-container matColumnDef>
<th mat-header-cell *matHeaderCellDef [style.text-align]="justify">
{{headerText}}
</th>
<td mat-cell *matCellDef="let data" [style.text-align]="justify">
{{dataAccessor(data, name)}}
</td>
</ng-container>
`;

/**
* Column that simply shows text content for the header and row cells. Assumes that the table
* is using the native table implementation (`<table>`).
Expand All @@ -31,7 +20,16 @@ export const _MAT_TEXT_COLUMN_TEMPLATE = `
*/
@Component({
selector: 'mat-text-column',
template: _MAT_TEXT_COLUMN_TEMPLATE,
template: `
<ng-container matColumnDef>
<th mat-header-cell *matHeaderCellDef [style.text-align]="justify">
{{headerText}}
</th>
<td mat-cell *matCellDef="let data" [style.text-align]="justify">
{{dataAccessor(data, name)}}
</td>
</ng-container>
`,
encapsulation: ViewEncapsulation.None,
// Change detection is intentionally not set to OnPush. This component's template will be provided
// to the table to be inserted into its view. This is problematic when change detection runs since
Expand Down
2 changes: 0 additions & 2 deletions tools/public_api_guard/material/table.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export declare const _MAT_TEXT_COLUMN_TEMPLATE = "\n <ng-container matColumnDef>\n <th mat-header-cell *matHeaderCellDef [style.text-align]=\"justify\">\n {{headerText}}\n </th>\n <td mat-cell *matCellDef=\"let data\" [style.text-align]=\"justify\">\n {{dataAccessor(data, name)}}\n </td>\n </ng-container>\n";

export declare class _MatTableDataSource<T, P extends Paginator> extends DataSource<T> {
_renderChangesSubscription: Subscription | null;
get data(): T[];
Expand Down