|
|
|
@ -1,4 +1,4 @@ |
|
|
|
<div ngbDropdown container="body" class="d-inline-block"> |
|
|
|
<div *ngIf="actionList.length !== 1" ngbDropdown container="body" class="d-inline-block"> |
|
|
|
<button |
|
|
|
class="btn btn-primary btn-sm dropdown-toggle" |
|
|
|
data-toggle="dropdown" |
|
|
|
@ -8,17 +8,35 @@ |
|
|
|
<i [ngClass]="icon" [class.mr-1]="icon"></i>{{ text | abpLocalization }} |
|
|
|
</button> |
|
|
|
<div ngbDropdownMenu> |
|
|
|
<ng-container *ngFor="let action of actionList; trackBy: trackByFn"> |
|
|
|
<button |
|
|
|
*ngIf="action.visible(data)" |
|
|
|
ngbDropdownItem |
|
|
|
[abpPermission]="action.permission" |
|
|
|
(click)="action.action(data)" |
|
|
|
type="button" |
|
|
|
> |
|
|
|
<i [ngClass]="action.icon" [class.mr-1]="action.icon"></i> |
|
|
|
{{ action.text | abpLocalization }} |
|
|
|
</button> |
|
|
|
<ng-container |
|
|
|
*ngFor="let action of actionList; trackBy: trackByFn" |
|
|
|
[ngTemplateOutlet]="btnItem" |
|
|
|
[ngTemplateOutletContext]="{ $implicit: action }" |
|
|
|
> |
|
|
|
</ng-container> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<ng-container |
|
|
|
*ngIf="actionList.length === 1" |
|
|
|
[ngTemplateOutlet]="btnItem" |
|
|
|
[ngTemplateOutletContext]="{ $implicit: actionList.get(0).value }" |
|
|
|
></ng-container> |
|
|
|
|
|
|
|
<ng-template #btnItem let-action> |
|
|
|
<button |
|
|
|
*ngIf="action.visible(data)" |
|
|
|
ngbDropdownItem |
|
|
|
[abpPermission]="action.permission" |
|
|
|
(click)="action.action(data)" |
|
|
|
type="button" |
|
|
|
class="{{ actionList.length === 1 ? 'btn btn-primary' : '' }}" |
|
|
|
[class.text-center]="actionList.length === 1" |
|
|
|
> |
|
|
|
<i [ngClass]="action.icon" [class.mr-1]="action.icon"></i> |
|
|
|
<span *ngIf="action.icon; else ellipsis">{{ action.text | abpLocalization }}</span> |
|
|
|
<ng-template #ellipsis> |
|
|
|
<div abpEllipsis>{{ action.text | abpLocalization }}</div> |
|
|
|
</ng-template> |
|
|
|
</button> |
|
|
|
</ng-template> |
|
|
|
|