Skip to content

Commit

Permalink
feat(entity-table): add option to choose button style
Browse files Browse the repository at this point in the history
  • Loading branch information
ameliebernier authored and mbarbeau committed Aug 7, 2019
1 parent b1083e8 commit d0d4aae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,22 @@
<ng-container *ngIf="columnRenderer === entityTableColumnRenderer.ButtonGroup">
<td mat-cell *matCellDef="let entity" class="mat-cell-text"
[ngClass]="getCellClass(entity, column)">
<button *ngFor="let button of getValue(entity, column)"
mat-mini-fab
igoStopPropagation
[color]="button.color"
(click)="onButtonClick(button.click, entity)">
<mat-icon svgIcon="{{button.icon}}"></mat-icon>
</button>
<span *ngFor="let button of getValue(entity, column)">
<button *ngIf="button.style === 'mat-icon-button'"
igoStopPropagation
mat-icon-button
[color]="button.color"
(click)="onButtonClick(button.click, entity)">
<mat-icon svgIcon="{{button.icon}}"></mat-icon>
</button>
<button *ngIf="button.style !== 'mat-icon-button'"
igoStopPropagation
mat-mini-fab
[color]="button.color"
(click)="onButtonClick(button.click, entity)">
<mat-icon svgIcon="{{button.icon}}"></mat-icon>
</button>
</span>
</td>
</ng-container>
</ng-container>
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/lib/entity/shared/entity.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ export interface EntityTableButton {
icon: string;
click: (entity: object) => void;
color?: 'primary' | 'accent' | 'warn';
style?: 'mat-mini-fab' | 'mat-icon-button';
}

0 comments on commit d0d4aae

Please sign in to comment.