1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { CdkTextColumn } from '@angular/cdk/table';
|
---|
9 | import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
|
---|
10 | /**
|
---|
11 | * Column that simply shows text content for the header and row cells. Assumes that the table
|
---|
12 | * is using the native table implementation (`<table>`).
|
---|
13 | *
|
---|
14 | * By default, the name of this column will be the header text and data property accessor.
|
---|
15 | * The header text can be overridden with the `headerText` input. Cell values can be overridden with
|
---|
16 | * the `dataAccessor` input. Change the text justification to the start or end using the `justify`
|
---|
17 | * input.
|
---|
18 | */
|
---|
19 | export class MatTextColumn extends CdkTextColumn {
|
---|
20 | }
|
---|
21 | MatTextColumn.decorators = [
|
---|
22 | { type: Component, args: [{
|
---|
23 | selector: 'mat-text-column',
|
---|
24 | template: `
|
---|
25 | <ng-container matColumnDef>
|
---|
26 | <th mat-header-cell *matHeaderCellDef [style.text-align]="justify">
|
---|
27 | {{headerText}}
|
---|
28 | </th>
|
---|
29 | <td mat-cell *matCellDef="let data" [style.text-align]="justify">
|
---|
30 | {{dataAccessor(data, name)}}
|
---|
31 | </td>
|
---|
32 | </ng-container>
|
---|
33 | `,
|
---|
34 | encapsulation: ViewEncapsulation.None,
|
---|
35 | // Change detection is intentionally not set to OnPush. This component's template will be provided
|
---|
36 | // to the table to be inserted into its view. This is problematic when change detection runs since
|
---|
37 | // the bindings in this template will be evaluated _after_ the table's view is evaluated, which
|
---|
38 | // mean's the template in the table's view will not have the updated value (and in fact will cause
|
---|
39 | // an ExpressionChangedAfterItHasBeenCheckedError).
|
---|
40 | // tslint:disable-next-line:validate-decorators
|
---|
41 | changeDetection: ChangeDetectionStrategy.Default
|
---|
42 | },] }
|
---|
43 | ];
|
---|
44 | //# sourceMappingURL=data:application/json;base64,eyJ2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