Skip to content

Commit 2f25af6

Browse files
committed
chore: fix table sticky column file name (#11717)
1 parent 7bd6c1f commit 2f25af6

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

src/demo-app/table/table-demo.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,11 @@ export class TableDemo {
2828
'table-row-context',
2929
'table-selection',
3030
'table-sorting',
31+
'table-expandable-rows',
32+
'table-sticky-header',
33+
'table-sticky-columns',
34+
'table-sticky-footer',
35+
'table-sticky-complex',
36+
'table-sticky-complex-flex',
3137
];
3238
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.example-container {
2+
height: 400px;
3+
width: 550px;
4+
overflow: auto;
5+
}
6+
7+
table {
8+
width: 800px;
9+
}
10+
11+
td.mat-column-star {
12+
width: 20px;
13+
padding-right: 8px;
14+
}
15+
16+
th.mat-column-position, td.mat-column-position {
17+
padding-left: 8px;
18+
}
19+
20+
.mat-table-sticky:first-child {
21+
border-right: 1px solid #e0e0e0;
22+
}
23+
24+
.mat-table-sticky:last-child {
25+
border-left: 1px solid #e0e0e0;
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div class="example-container mat-elevation-z8">
2+
<table mat-table [dataSource]="dataSource">
3+
4+
<!-- Name Column -->
5+
<ng-container matColumnDef="name" sticky>
6+
<th mat-header-cell *matHeaderCellDef> Name </th>
7+
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
8+
</ng-container>
9+
10+
<!-- Position Column -->
11+
<ng-container matColumnDef="position">
12+
<th mat-header-cell *matHeaderCellDef> No. </th>
13+
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
14+
</ng-container>
15+
16+
<!-- Weight Column -->
17+
<ng-container matColumnDef="weight">
18+
<th mat-header-cell *matHeaderCellDef> Weight </th>
19+
<td mat-cell *matCellDef="let element"> {{element.weight}} </td>
20+
</ng-container>
21+
22+
<!-- Symbol Column -->
23+
<ng-container matColumnDef="symbol">
24+
<th mat-header-cell *matHeaderCellDef> Symbol </th>
25+
<td mat-cell *matCellDef="let element"> {{element.symbol}} </td>
26+
</ng-container>
27+
28+
<!-- Star Column -->
29+
<ng-container matColumnDef="star" stickyEnd>
30+
<th mat-header-cell *matHeaderCellDef></th>
31+
<td mat-cell *matCellDef="let element">
32+
<mat-icon>more_vert</mat-icon>
33+
</td>
34+
</ng-container>
35+
36+
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
37+
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
38+
</table>
39+
</div>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {Component} from '@angular/core';
2+
3+
/**
4+
* @title Table with a sticky columns
5+
*/
6+
@Component({
7+
selector: 'table-sticky-columns-example',
8+
styleUrls: ['table-sticky-columns-example.css'],
9+
templateUrl: 'table-sticky-columns-example.html',
10+
})
11+
export class TableStickyColumnsExample {
12+
displayedColumns =
13+
['name', 'position', 'weight', 'symbol', 'position', 'weight', 'symbol', 'star'];
14+
dataSource = ELEMENT_DATA;
15+
}
16+
17+
export interface PeriodicElement {
18+
name: string;
19+
position: number;
20+
weight: number;
21+
symbol: string;
22+
}
23+
24+
const ELEMENT_DATA: PeriodicElement[] = [
25+
{position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
26+
{position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
27+
{position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
28+
{position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
29+
{position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
30+
{position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
31+
{position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
32+
{position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'},
33+
{position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'},
34+
{position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'},
35+
];

0 commit comments

Comments
 (0)