|
|
|
@ -5,12 +5,12 @@ |
|
|
|
aria-haspopup="true" |
|
|
|
ngbDropdownToggle |
|
|
|
> |
|
|
|
<i [ngClass]="icon" [class.mr-1]="icon"></i>{{ text | abpLocalization }} |
|
|
|
<i [ngClass]="icon" [class.me-1]="icon"></i>{{ text | abpLocalization }} |
|
|
|
</button> |
|
|
|
<div ngbDropdownMenu> |
|
|
|
<ng-container |
|
|
|
*ngFor="let action of actionList; trackBy: trackByFn" |
|
|
|
[ngTemplateOutlet]="btnItem" |
|
|
|
[ngTemplateOutlet]="dropDownBtnItemTmp" |
|
|
|
[ngTemplateOutletContext]="{ $implicit: action }" |
|
|
|
> |
|
|
|
</ng-container> |
|
|
|
@ -19,25 +19,44 @@ |
|
|
|
|
|
|
|
<ng-container |
|
|
|
*ngIf="actionList.length === 1" |
|
|
|
[ngTemplateOutlet]="btnItem" |
|
|
|
[ngTemplateOutlet]="btnTmp" |
|
|
|
[ngTemplateOutletContext]="{ $implicit: actionList.get(0).value }" |
|
|
|
></ng-container> |
|
|
|
|
|
|
|
<ng-template #btnItem let-action> |
|
|
|
<ng-template #dropDownBtnItemTmp let-action> |
|
|
|
<ng-container *ngIf="action.visible(data)"> |
|
|
|
<button |
|
|
|
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> |
|
|
|
<ng-container |
|
|
|
*ngTemplateOutlet="buttonContentTmp; context: { $implicit: action }" |
|
|
|
></ng-container> |
|
|
|
</button> |
|
|
|
</ng-container> |
|
|
|
</ng-template> |
|
|
|
|
|
|
|
<ng-template #buttonContentTmp let-action> |
|
|
|
<i [ngClass]="action.icon" [class.me-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> |
|
|
|
</ng-template> |
|
|
|
|
|
|
|
<ng-template #btnTmp let-action> |
|
|
|
<ng-container *ngIf="action.visible(data)"> |
|
|
|
<button |
|
|
|
*abpPermission="action.permission" |
|
|
|
(click)="action.action(data)" |
|
|
|
type="button" |
|
|
|
class="btn btn-primary text-center" |
|
|
|
> |
|
|
|
<ng-container |
|
|
|
*ngTemplateOutlet="buttonContentTmp; context: { $implicit: action }" |
|
|
|
></ng-container> |
|
|
|
</button> |
|
|
|
</ng-container> |
|
|
|
</ng-template> |
|
|
|
|