-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): Improved control over ActionBar buttons
This commit implements setting disabled and visible states, as well as providing the `Injector` instance to the click handler.
- Loading branch information
1 parent
ba2026e
commit 065a2b4
Showing
4 changed files
with
65 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 14 additions & 11 deletions
25
...in-ui/src/lib/core/src/shared/components/action-bar-items/action-bar-items.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
<vdr-ui-extension-point [locationId]="locationId" api="actionBar" [leftPx]="-24"> | ||
<ng-container *ngFor="let item of items$ | async"> | ||
<button | ||
*vdrIfPermissions="item.requiresPermission" | ||
[routerLink]="getRouterLink(item)" | ||
[disabled]="item.disabled ? (item.disabled | async) : false" | ||
(click)="handleClick($event, item)" | ||
[ngClass]="getButtonStyles(item)" | ||
class="mr-2" | ||
> | ||
<clr-icon *ngIf="item.icon" [attr.shape]="item.icon"></clr-icon> | ||
{{ item.label | translate }} | ||
</button> | ||
<ng-container *ngIf="buttonStates[item.id] | async as buttonState"> | ||
<button | ||
*vdrIfPermissions="item.requiresPermission" | ||
[routerLink]="getRouterLink(item)" | ||
[class.hidden]="buttonState.visible === false" | ||
[disabled]="buttonState.disabled || (item.disabled ? (item.disabled | async) : false)" | ||
(click)="handleClick($event, item)" | ||
[ngClass]="getButtonStyles(item)" | ||
class="mr-2" | ||
> | ||
<clr-icon *ngIf="item.icon" [attr.shape]="item.icon"></clr-icon> | ||
{{ item.label | translate }} | ||
</button> | ||
</ng-container> | ||
</ng-container> | ||
</vdr-ui-extension-point> |
4 changes: 4 additions & 0 deletions
4
...in-ui/src/lib/core/src/shared/components/action-bar-items/action-bar-items.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
:host { | ||
display: inline-block; | ||
} | ||
|
||
button.hidden { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters