ngx-redi-core 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@ import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
|
2
2
|
import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
|
-
selector: '
|
|
5
|
+
selector: 'redi-grid',
|
|
6
6
|
templateUrl: './redi-grid.component.html',
|
|
7
7
|
styleUrls: ['./redi-grid.component.css']
|
|
8
8
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="container">
|
|
2
2
|
<div *ngIf="enableFilter">
|
|
3
|
-
<mat-icon>search</mat-icon>
|
|
3
|
+
<mat-icon> search </mat-icon>
|
|
4
4
|
<input placeholder="Filtro" (keyup)="applyFilter($event)" />
|
|
5
5
|
</div>
|
|
6
6
|
<div class="section">
|
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
<ng-container>
|
|
25
25
|
<ng-container [matColumnDef]="column.key" *ngFor="let column of colsEntities">
|
|
26
|
-
<th mat-header-cell *matHeaderCellDef mat-sort-header [attr.disabled]="isSortActive()">
|
|
26
|
+
<th mat-header-cell *matHeaderCellDef mat-sort-header [attr.disabled]="isSortActive()">
|
|
27
|
+
{{column.label ||
|
|
27
28
|
column.key}} </th>
|
|
28
29
|
<td mat-cell *matCellDef="let element"> {{element[column.key]}} </td>
|
|
29
30
|
</ng-container>
|
|
30
31
|
</ng-container>
|
|
31
|
-
<ng-container *ngIf="
|
|
32
|
+
<ng-container *ngIf="showActions()" matColumnDef="actions" stickyEnd>
|
|
32
33
|
<th mat-header-cell *matHeaderCellDef aria-label="row actions"> </th>
|
|
33
34
|
<td mat-cell *matCellDef="let element">
|
|
34
35
|
<button mat-icon-button color="primary" *ngFor="let action of dataTable.actions"
|
|
@@ -22,8 +22,6 @@ export class RediTableComponent<T> implements AfterViewInit, OnChanges {
|
|
|
22
22
|
@Input()
|
|
23
23
|
public sortData: boolean = false;
|
|
24
24
|
|
|
25
|
-
public actions: boolean = false;
|
|
26
|
-
|
|
27
25
|
@Input()
|
|
28
26
|
public dataTable: DataTable<T>;
|
|
29
27
|
|
|
@@ -101,8 +99,7 @@ export class RediTableComponent<T> implements AfterViewInit, OnChanges {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
this.displayedColumns.push(...this.colsEntities.map(item => { return item.key }));
|
|
104
|
-
|
|
105
|
-
if (this.actions) {
|
|
102
|
+
if (this.showActions()) {
|
|
106
103
|
this.displayedColumns.push('actions')
|
|
107
104
|
}
|
|
108
105
|
this.dataSource.sort = this.sort;
|
|
@@ -110,6 +107,10 @@ export class RediTableComponent<T> implements AfterViewInit, OnChanges {
|
|
|
110
107
|
this.translatePaginator();
|
|
111
108
|
}
|
|
112
109
|
|
|
110
|
+
public showActions(): boolean {
|
|
111
|
+
return this.dataTable.actions && this.dataTable.actions.length > 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
113
114
|
private translatePaginator() {
|
|
114
115
|
this.paginator._intl.itemsPerPageLabel = 'Elementos por pagina';
|
|
115
116
|
this.paginator._intl.firstPageLabel = 'Primera pagina';
|