-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathngx-ez-table.component.html
74 lines (70 loc) · 4.18 KB
/
ngx-ez-table.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<div class="ngx-ez-table">
<div class="ngx-ez-table__loading" *ngIf="isLoading"></div>
<table class="ngx-ez-table__wrapper">
<thead>
<tr>
<th *ngIf="config.rowDetails && detailsRef"></th>
<th *ngFor="let header of columns" class="{{header.headerClass || ''}}" (click)="onSortByColumn(header.accessor)">
{{header.title}}
<ng-container *ngIf="sortByColumn === header.accessor">
<span class="ngx-ez-table__sort-icon" *ngIf="sortDirection === 'ASC'">▲</span>
<span class="ngx-ez-table__sort-icon" *ngIf="sortDirection === 'DESC'">▼</span>
</ng-container>
</th>
</tr>
<tr ngx-ez-table-filters [hasDetails]="config.rowDetails && detailsRef" *ngIf="config.searchable" [columns]="columns" #filter></tr>
</thead>
<tbody>
<!-- Default Renderer -->
<ng-container *ngIf="!rowTemplateRef && visibleRows.length > 0">
<ng-container *ngFor="let row of visibleRows">
<tr>
<td class="ngx-ez-table__row-details-toggle" *ngIf="config.rowDetails && detailsRef" (click)="toggleRowDetails(row.ngxEzTableId)">
<ng-container *ngIf="openDetails.has(row.ngxEzTableId)">▲</ng-container>
<ng-container *ngIf="!openDetails.has(row.ngxEzTableId)">▼</ng-container>
</td>
<td *ngFor="let cell of columns" class="{{cell.cellClass || ''}}">
{{deepFind(row, cell.accessor)}}
</td>
</tr>
<ng-container *ngIf="config.rowDetails && detailsRef && openDetails.has(row.ngxEzTableId)">
<tr class="ngx-ez-table__row-details">
<td [colSpan]="columns.length">
<ng-template [ngTemplateOutlet]="detailsRef" [ngTemplateOutletContext]="{$implicit: row}"></ng-template>
</td>
</tr>
</ng-container>
</ng-container>
</ng-container>
<!-- User defined renderer -->
<ng-container *ngIf="rowTemplateRef">
<ng-container *ngFor="let row of visibleRows; let i = index;">
<tr [class]="getRowClass(row)">
<td class="ngx-ez-table__row-details-toggle" *ngIf="config.rowDetails && detailsRef" (click)="toggleRowDetails(row.ngxEzTableId)">
<ng-container *ngIf="openDetails.has(row.ngxEzTableId)">▲</ng-container>
<ng-container *ngIf="!openDetails.has(row.ngxEzTableId)">▼</ng-container>
</td>
<ng-template [ngTemplateOutlet]="rowTemplateRef" [ngTemplateOutletContext]="{$implicit: row}"></ng-template>
</tr>
<ng-container *ngIf="config.rowDetails && detailsRef && openDetails.has(row.ngxEzTableId)">
<tr class="ngx-ez-table__row-details">
<td class="ngx-ez-table__row-details-wrapper" [colSpan]="columns.length + 1">
<ng-template [ngTemplateOutlet]="detailsRef" [ngTemplateOutletContext]="{$implicit: row}"></ng-template>
</td>
</tr>
</ng-container>
</ng-container>
</ng-container>
</tbody>
</table>
<div class="ngx-ez-table__footer" *ngIf="config.pagination || config.pagination">
<div class="ngx-ez-table__footer-left">
<ngx-ez-table-pagination [totalPages]="totalPages" [currentPage]="currentPage" *ngIf="config.pagination"
#pagination></ngx-ez-table-pagination>
</div>
<div class="ngx-ez-table__footer-right">
<ngx-ez-table-page-size-selector [pageSize]="pageSize" [pageSizeOptions]="config.pageSizeOptions" *ngIf="config.pageSizeSelector"
#pageSizeSelector></ngx-ez-table-page-size-selector>
</div>
</div>
</div>