Browse Source
Merge pull request #12969 from abpframework/Issue-9932-CP
PageToolbar buton class added.
pull/12971/head
Muhammed Altuğ
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
2 deletions
-
npm/ng-packs/packages/theme-shared/extensions/src/lib/components/page-toolbar/page-toolbar.component.html
-
npm/ng-packs/packages/theme-shared/extensions/src/lib/components/page-toolbar/page-toolbar.component.ts
-
npm/ng-packs/packages/theme-shared/extensions/src/lib/models/toolbar-actions.ts
|
|
|
@ -13,7 +13,7 @@ |
|
|
|
</ng-container> |
|
|
|
|
|
|
|
<ng-template #button> |
|
|
|
<button (click)="action.action(data)" type="button" class="btn btn-primary btn-sm"> |
|
|
|
<button (click)="action.action(data)" type="button" [ngClass]="action.btnClass ? action.btnClass : defaultBtnClass" > |
|
|
|
<i [ngClass]="action.icon" [class.me-1]="action.icon"></i> |
|
|
|
{{ action.text | abpLocalization }} |
|
|
|
</button> |
|
|
|
|
|
|
|
@ -28,6 +28,7 @@ import { AbstractActionsComponent } from '../abstract-actions/abstract-actions.c |
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
|
}) |
|
|
|
export class PageToolbarComponent<R = any> extends AbstractActionsComponent<ToolbarActionList<R>> { |
|
|
|
defaultBtnClass = 'btn btn-sm btn-primary'; |
|
|
|
readonly trackByFn: TrackByFunction<ToolbarComponent<R>> = (_, item) => |
|
|
|
item.action || item.component; |
|
|
|
|
|
|
|
|
|
|
|
@ -25,11 +25,15 @@ export class ToolbarActionsFactory<R = any> extends ActionsFactory<ToolbarAction |
|
|
|
export class ToolbarAction<R = any> extends Action<R> { |
|
|
|
readonly text: string; |
|
|
|
readonly icon: string; |
|
|
|
readonly btnClass?: string; |
|
|
|
|
|
|
|
constructor(options: ToolbarActionOptions<R>) { |
|
|
|
super(options.permission || '', options.visible, options.action); |
|
|
|
this.text = options.text; |
|
|
|
this.icon = options.icon || ''; |
|
|
|
if(options.btnClass){ |
|
|
|
this.btnClass = options.btnClass; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
static create<R = any>(options: ToolbarActionOptions<R>) { |
|
|
|
@ -60,7 +64,7 @@ export class ToolbarComponent<R = any> extends Action<R> { |
|
|
|
|
|
|
|
export type ToolbarActionOptions<R = any> = O.Optional< |
|
|
|
O.Writable<ToolbarAction<R>>, |
|
|
|
'permission' | 'visible' | 'icon' |
|
|
|
'permission' | 'visible' | 'icon' | 'btnClass' |
|
|
|
>; |
|
|
|
|
|
|
|
export type ToolbarComponentOptions<R = any> = O.Optional< |
|
|
|
|