Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disabled header action buttons can have tooltip #633

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,23 @@ <h2 id="page-subheader" *ngIf="!!subheader">{{ subheader }}</h2>
<ng-container *ngIf="!loading; else skeletonActions">
<div *ngIf="inlineActions && inlineActions.length > 0" class="toolbar flex flex-wrap gap-1 sm:gap-2">
<ng-container *ngFor="let action of inlineActions">
<p-button
id="{{ action.id }}"
[icon]="action.icon ?? ''"
type="button"
class="action-button"
[label]="action.labelKey ? (action.labelKey | translate) : action.label"
(onClick)="action.actionCallback()"
[pTooltip]="(action.titleKey ? (action.titleKey | translate) : action.title)"
<span
[pTooltip]="action.disabled ? (action.disabledTooltipKey ? (action.disabledTooltipKey | translate) : action.disabledTooltip) : (action.titleKey ? (action.titleKey | translate) : action.title)"
tooltipPosition="top"
tooltipEvent="hover"
[disabled]="action.disabled ? action.disabled : false"
[attr.name]="action.icon ? 'ocx-page-header-inline-action-icon-button' : 'ocx-page-header-inline-action-button'"
[ariaLabel]=" (action.ariaLabelKey ? (action.ariaLabelKey | translate) : action.ariaLabel) || (action.titleKey ? (action.titleKey | translate) : action.title) || (action.labelKey ? (action.labelKey | translate) : action.label)"
></p-button>
>
<p-button
id="{{ action.id }}"
[icon]="action.icon ?? ''"
type="button"
class="action-button"
[label]="action.labelKey ? (action.labelKey | translate) : action.label"
(onClick)="action.actionCallback()"
[disabled]="action.disabled ? action.disabled : false"
[attr.name]="action.icon ? 'ocx-page-header-inline-action-icon-button' : 'ocx-page-header-inline-action-button'"
[ariaLabel]=" (action.ariaLabelKey ? (action.ariaLabelKey | translate) : action.ariaLabel) || (action.titleKey ? (action.titleKey | translate) : action.title) || (action.labelKey ? (action.labelKey | translate) : action.label)"
></p-button>
</span>
</ng-container>
</div>
<ng-content select="[toolbarItems]"></ng-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface Action {
btnClass?: string
actionCallback(): void
disabled?: boolean
disabledTooltip?: string
disabledTooltipKey?: string
show?: 'always' | 'asOverflow'
conditional?: boolean
// Note: This currently doesn't work with dynamic values, since a passed in Action is just a copy of the original object.
Expand Down
Loading