diff --git a/docs/en/UI/Angular/Entity-Action-Extensions.md b/docs/en/UI/Angular/Entity-Action-Extensions.md index 1ee0a3b70a..6a9df909fb 100644 --- a/docs/en/UI/Angular/Entity-Action-Extensions.md +++ b/docs/en/UI/Angular/Entity-Action-Extensions.md @@ -312,6 +312,8 @@ type EntityActionOptions = { icon?: string, permission?: string, visible?: ActionPredicate, + btnClass?: string, + btnStyle?: string, }; ``` @@ -322,6 +324,8 @@ As you see, passing `action` and `text` is enough to create an entity action. He - **icon** is the classes that define an icon to be placed before the text. (_default:_ `''`) - **permission** is the permission context which will be used to decide if this type of grid action should be displayed to the user or not. (_default:_ `undefined`) - **visible** is a predicate that will be used to decide if the current record should have this grid action or not. (_default:_ `() => true`) +- **btnClass** is the classes that will be applied to the button. (_default:_ `'btn btn-primary'`) +- **btnStyle** is the styles that will be applied to the button. (_default:_ `''`) You may find a full example below. @@ -339,6 +343,8 @@ const options: EntityActionOptions = { icon: 'fa fa-unlock', permission: 'AbpIdentity.Users.Update', visible: data => data.record.isLockedOut, + btnClass:'btn-warning', + btnStyle: 'margin-right: 5px;', }; const action = new EntityAction(options); diff --git a/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/grid-actions/grid-actions.component.html b/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/grid-actions/grid-actions.component.html index 49cca7d326..9f567271a4 100644 --- a/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/grid-actions/grid-actions.component.html +++ b/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/grid-actions/grid-actions.component.html @@ -52,7 +52,8 @@ *abpPermission="action.permission; runChangeDetection: false" (click)="action.action(data)" type="button" - class="btn btn-primary text-center" + [class]="action.btnClass" + [style]="action.btnStyle" > { public readonly permission: string, public readonly visible: ActionPredicate = () => true, public readonly action: ActionCallback = () => {}, + public readonly btnClass?: string, + public readonly btnStyle?: string, ) {} } diff --git a/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-actions.ts b/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-actions.ts index 99253c0da8..4a801e841e 100644 --- a/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-actions.ts +++ b/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-actions.ts @@ -22,11 +22,15 @@ export class EntityActionsFactory extends ActionsFactory extends Action { readonly text: string; readonly icon: string; + readonly btnClass?: string; + readonly btnStyle?: string; constructor(options: EntityActionOptions) { super(options.permission || '', options.visible, options.action); this.text = options.text; this.icon = options.icon || ''; + this.btnClass = options.btnClass || 'btn btn-primary text-center'; + this.btnStyle = options.btnStyle; } static create(options: EntityActionOptions) { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/models/nav-item.ts b/npm/ng-packs/packages/theme-shared/src/lib/models/nav-item.ts index c673bc74e2..3afce94a0c 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/models/nav-item.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/models/nav-item.ts @@ -18,6 +18,7 @@ export class NavItem { order?: number; requiredPolicy?: string; visible?: NavBarPropPredicate; + icon?: string; constructor(props: Partial) { Object.assign(this, props); }