|
2 | 2 | <mat-label>Filter</mat-label>
|
3 | 3 | <input matInput (keyup)="applyFilter($event)" placeholder="Ex. Up to Date">
|
4 | 4 | </mat-form-field>
|
5 |
| -<table mat-table class="full-width-table" matSort aria-label="Elements"> |
6 |
| - <!-- Id Column --> |
7 |
| - <ng-container matColumnDef="id"> |
8 |
| - <th mat-header-cell *matHeaderCellDef mat-sort-header>Id</th> |
9 |
| - <td mat-cell *matCellDef="let row">{{row.id}}</td> |
| 5 | +<table mat-table class="full-width-table" matSort aria-label="Folders" multiTemplateDataRows> |
| 6 | + <ng-container matColumnDef="{{column}}" *ngFor="let column of displayedColumns"> |
| 7 | + <th mat-header-cell *matHeaderCellDef> {{column}} </th> |
| 8 | + <td mat-cell *matCellDef="let folder"> {{folder[column]}} </td> |
10 | 9 | </ng-container>
|
11 |
| - |
12 |
| - <!-- Label Column --> |
13 |
| - <ng-container matColumnDef="label"> |
14 |
| - <th mat-header-cell *matHeaderCellDef mat-sort-header>Name</th> |
15 |
| - <td mat-cell *matCellDef="let row">{{row.label}}</td> |
16 |
| - </ng-container> |
17 |
| - |
18 |
| - <!-- Path Column --> |
19 |
| - <ng-container matColumnDef="path"> |
20 |
| - <th mat-header-cell *matHeaderCellDef mat-sort-header>Path</th> |
21 |
| - <td mat-cell *matCellDef="let row">{{row.path}}</td> |
22 |
| - </ng-container> |
23 |
| - |
24 |
| - <!-- Status Column --> |
25 |
| - <ng-container matColumnDef="state"> |
26 |
| - <th mat-header-cell *matHeaderCellDef mat-sort-header>State</th> |
27 |
| - <td mat-cell *matCellDef="let row">{{row.state}}</td> |
| 10 | + <!-- Expanded Content Column - The detail row is made up of this one column that spans across all columns --> |
| 11 | + <ng-container matColumnDef="expandedDetail"> |
| 12 | + <td mat-cell *matCellDef="let folder" [attr.colspan]="displayedColumns.length"> |
| 13 | + <div class="folder-detail" [@detailExpand]="folder == expandedFolder ? 'expanded' : 'collapsed'"> |
| 14 | + <div class="folder-devices"> |
| 15 | + <span>Shared with: </span> |
| 16 | + <span class="device-name" *ngFor="let device of folder.devices">{{device.name}}</span> |
| 17 | + </div> |
| 18 | + </div> |
| 19 | + </td> |
28 | 20 | </ng-container>
|
29 | 21 |
|
30 | 22 | <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
31 |
| - <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> |
| 23 | + <tr mat-row *matRowDef="let folder; columns: displayedColumns;" class="folder-row" |
| 24 | + [class.example-expanded-row]="expandedFolder === folder" |
| 25 | + (click)="expandedFolder = expandedFolder === folder ? null : folder"> |
| 26 | + </tr> |
| 27 | + <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="detail-row"></tr> |
32 | 28 | </table>
|
33 | 29 |
|
34 | 30 | <mat-paginator #paginator [length]="dataSource?.data.length" [pageIndex]="0" [pageSize]="25"
|
|
0 commit comments