-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: further performance improvements for tables (#1810)
Co-authored-by: Simon <simon@aam-digital.com>
- Loading branch information
1 parent
95d8108
commit 00c3822
Showing
6 changed files
with
217 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
257 changes: 121 additions & 136 deletions
257
.../core/entity-components/entity-subrecord/entity-subrecord/entity-subrecord.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,152 +1,137 @@ | ||
<div *ngIf="isLoading" class="process-spinner"> | ||
<mat-progress-bar mode="indeterminate"></mat-progress-bar> | ||
</div> | ||
<table | ||
mat-table | ||
[dataSource]="recordsDataSource" | ||
matSort | ||
class="full-width" | ||
*ngIf="!isLoading" | ||
> | ||
<ng-container *ngFor="let col of filteredColumns" [matColumnDef]="col.id"> | ||
<th | ||
mat-header-cell | ||
mat-sort-header | ||
*matHeaderCellDef | ||
[matTooltip]="col.tooltip" | ||
[matTooltipDisabled]="!col.tooltip" | ||
[disabled]="col.noSorting" | ||
> | ||
{{ col.label }} | ||
</th> | ||
<td | ||
mat-cell | ||
*matCellDef="let row" | ||
(click)="onRowClick(row)" | ||
style="cursor: pointer" | ||
> | ||
<ng-template | ||
*ngIf="!row.formGroup || row.formGroup.disabled || !col.edit" | ||
[appDynamicComponent]="{ | ||
component: col.view, | ||
config: { | ||
value: row.record[col.id], | ||
id: col.id, | ||
entity: row.record, | ||
config: col.additional | ||
} | ||
}" | ||
></ng-template> | ||
<ng-template | ||
*ngIf="row.formGroup?.enabled && col.edit" | ||
[appDynamicComponent]="{ | ||
component: col.edit, | ||
config: { | ||
formFieldConfig: col, | ||
propertySchema: row.record.getSchema().get(col.id), | ||
formControl: row.formGroup.get(col.id) | ||
} | ||
}" | ||
<div [hidden]="isLoading"> | ||
<table mat-table [dataSource]="recordsDataSource" matSort class="full-width"> | ||
<ng-container *ngFor="let col of filteredColumns" [matColumnDef]="col.id"> | ||
<th | ||
mat-header-cell | ||
mat-sort-header | ||
*matHeaderCellDef | ||
[matTooltip]="col.tooltip" | ||
[matTooltipDisabled]="!col.tooltip" | ||
[disabled]="col.noSorting" | ||
> | ||
</ng-template> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="actions"> | ||
<th mat-header-cell *matHeaderCellDef [class.remove-padding-left]="editable"> | ||
<ng-container *ngIf="editable"> | ||
<button | ||
mat-icon-button | ||
*appDisabledEntityOperation="{ | ||
entity: getEntityConstructor(), | ||
operation: 'create' | ||
{{ col.label }} | ||
</th> | ||
<td | ||
mat-cell | ||
*matCellDef="let row" | ||
(click)="onRowClick(row)" | ||
style="cursor: pointer" | ||
> | ||
<ng-template | ||
*ngIf="!row.formGroup || row.formGroup.disabled || !col.edit" | ||
[appDynamicComponent]="{ | ||
component: col.view, | ||
config: { | ||
value: row.record[col.id], | ||
id: col.id, | ||
entity: row.record, | ||
config: col.additional | ||
} | ||
}" | ||
></ng-template> | ||
<ng-template | ||
*ngIf="row.formGroup?.enabled && col.edit" | ||
[appDynamicComponent]="{ | ||
component: col.edit, | ||
config: { | ||
formFieldConfig: col, | ||
propertySchema: row.record.getSchema().get(col.id), | ||
formControl: row.formGroup.get(col.id) | ||
} | ||
}" | ||
class="table-action-button" | ||
(click)="create()" | ||
> | ||
<fa-icon | ||
style="vertical-align: initial" | ||
aria-label="add" | ||
icon="plus-circle" | ||
></fa-icon> | ||
</button> | ||
</ng-container> | ||
</th> | ||
<td mat-cell *matCellDef="let rec" [class.remove-padding-left]="editable"> | ||
<div *ngIf="editable"> | ||
<ng-container *ngIf="!rec.formGroup || rec.formGroup.disabled"> | ||
<button | ||
mat-icon-button | ||
*appDisabledEntityOperation="{ | ||
entity: rec.record, | ||
operation: 'update' | ||
}" | ||
(click)="edit(rec)" | ||
> | ||
<fa-icon | ||
aria-label="edit" | ||
icon="pen" | ||
></fa-icon> | ||
</button> | ||
</ng-container> | ||
<ng-container *ngIf="rec.formGroup?.enabled"> | ||
<button | ||
mat-icon-button | ||
(click)="save(rec)" | ||
angulartics2On="click" | ||
[angularticsCategory]="rec?.record?.getType()" | ||
angularticsAction="subrecord_inlineedit_save" | ||
> | ||
<fa-icon | ||
aria-label="save" | ||
icon="check-circle" | ||
></fa-icon> | ||
</button> | ||
<button | ||
mat-icon-button | ||
(click)="resetChanges(rec)" | ||
angulartics2On="click" | ||
[angularticsCategory]="rec?.record?.getType()" | ||
angularticsAction="subrecord_inlineedit_cancel" | ||
> | ||
<fa-icon | ||
aria-label="cancel" | ||
icon="times-circle" | ||
></fa-icon> | ||
</button> | ||
</ng-template> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="actions"> | ||
<th | ||
mat-header-cell | ||
*matHeaderCellDef | ||
[class.remove-padding-left]="editable" | ||
> | ||
<ng-container *ngIf="editable"> | ||
<button | ||
mat-icon-button | ||
*appDisabledEntityOperation="{ | ||
entity: rec.record, | ||
operation: 'delete' | ||
entity: getEntityConstructor(), | ||
operation: 'create' | ||
}" | ||
(click)="delete(rec)" | ||
angulartics2On="click" | ||
[angularticsCategory]="rec?.record?.getType()" | ||
angularticsAction="subrecord_inlineedit_delete" | ||
class="table-action-button" | ||
(click)="create()" | ||
> | ||
<fa-icon | ||
aria-label="delete" | ||
icon="trash" | ||
style="vertical-align: initial" | ||
aria-label="add" | ||
icon="plus-circle" | ||
></fa-icon> | ||
</button> | ||
</ng-container> | ||
</div> | ||
</td> | ||
</ng-container> | ||
</th> | ||
<td mat-cell *matCellDef="let rec" [class.remove-padding-left]="editable"> | ||
<div *ngIf="editable"> | ||
<ng-container *ngIf="!rec.formGroup || rec.formGroup.disabled"> | ||
<button | ||
mat-icon-button | ||
*appDisabledEntityOperation="{ | ||
entity: rec.record, | ||
operation: 'update' | ||
}" | ||
(click)="edit(rec)" | ||
> | ||
<fa-icon aria-label="edit" icon="pen"></fa-icon> | ||
</button> | ||
</ng-container> | ||
<ng-container *ngIf="rec.formGroup?.enabled"> | ||
<button | ||
mat-icon-button | ||
(click)="save(rec)" | ||
angulartics2On="click" | ||
[angularticsCategory]="rec?.record?.getType()" | ||
angularticsAction="subrecord_inlineedit_save" | ||
> | ||
<fa-icon aria-label="save" icon="check-circle"></fa-icon> | ||
</button> | ||
<button | ||
mat-icon-button | ||
(click)="resetChanges(rec)" | ||
angulartics2On="click" | ||
[angularticsCategory]="rec?.record?.getType()" | ||
angularticsAction="subrecord_inlineedit_cancel" | ||
> | ||
<fa-icon aria-label="cancel" icon="times-circle"></fa-icon> | ||
</button> | ||
<button | ||
mat-icon-button | ||
*appDisabledEntityOperation="{ | ||
entity: rec.record, | ||
operation: 'delete' | ||
}" | ||
(click)="delete(rec)" | ||
angulartics2On="click" | ||
[angularticsCategory]="rec?.record?.getType()" | ||
angularticsAction="subrecord_inlineedit_delete" | ||
> | ||
<fa-icon aria-label="delete" icon="trash"></fa-icon> | ||
</button> | ||
</ng-container> | ||
</div> | ||
</td> | ||
</ng-container> | ||
|
||
<tr mat-header-row *matHeaderRowDef="columnsToDisplay"></tr> | ||
<tr | ||
mat-row | ||
*matRowDef="let row; columns: columnsToDisplay" | ||
[style.background-color]="getBackgroundColor?.(row.record)" | ||
class="table-row" | ||
></tr> | ||
</table> | ||
<app-list-paginator | ||
[style.display]=" | ||
isLoading || recordsDataSource.data.length === 0 ? 'none' : '' | ||
" | ||
[dataSource]="recordsDataSource" | ||
[idForSavingPagination]="idForSavingPagination" | ||
></app-list-paginator> | ||
<tr mat-header-row *matHeaderRowDef="columnsToDisplay"></tr> | ||
<tr | ||
mat-row | ||
*matRowDef="let row; columns: columnsToDisplay" | ||
[style.background-color]="getBackgroundColor?.(row.record)" | ||
class="table-row" | ||
></tr> | ||
</table> | ||
<app-list-paginator | ||
[dataSource]="recordsDataSource" | ||
[idForSavingPagination]="idForSavingPagination" | ||
></app-list-paginator> | ||
</div> |
Oops, something went wrong.