Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pouyababaie committed Jan 22, 2024
1 parent 239b86c commit 73a2c67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/components/splitbutton/splitbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type SplitButtonIconPosition = 'left' | 'right';
class="p-splitbutton-menubutton p-button-icon-only"
(click)="onDropdownButtonClick($event)"
(keydown)="onDropdownButtonKeydown($event)"
[disabled]="disabled"
[disabled]="menuButtonDisabled"
[attr.aria-label]="menuButtonProps?.['aria-label'] || expandAriaLabel"
[attr.aria-haspopup]="menuButtonProps?.['aria-haspopup'] || true"
[attr.aria-expanded]="menuButtonProps?.['aria-expanded'] || isExpanded()"
Expand Down Expand Up @@ -127,6 +127,11 @@ export class SplitButton {
* @group Props
*/
@Input() disabled: boolean | undefined;
/**
* When present, it specifies that the element should be disabled.
* @group Props
*/
@Input() menuButtonDisabled: boolean | undefined;
/**
* Index of the element in tabbing order.
* @group Prop
Expand Down
15 changes: 14 additions & 1 deletion src/app/showcase/doc/splitbutton/disableddoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ import { Code } from '../../domain/code';
template: `
<app-docsectiontext>
<p>When <i>disabled</i> is present, the element cannot be edited and focused.</p>
<p>You can now use <i>menuButtonDisabled</i> to disable menu icon button.</p>
</app-docsectiontext>
<div class="card flex justify-content-center">
<p-toast></p-toast>
<p-splitButton label="Save" icon="pi pi-plus" (onClick)="save('info')" [model]="items" [disabled]="true"></p-splitButton>
</div>
<div class="card flex justify-content-center">
<p-toast></p-toast>
<p-splitButton label="Save" icon="pi pi-plus" (onClick)="save('info')" [model]="items" [menuButtonDisabled]="true"></p-splitButton>
</div>
<app-code [code]="code" selector="split-button-disabled-demo"></app-code>
`,
providers: [MessageService]
Expand Down Expand Up @@ -60,7 +65,15 @@ export class DisabledDoc {
<div class="card flex justify-content-center">
<p-toast></p-toast>
<p-splitButton label="Save" icon="pi pi-plus" (onClick)="save('info')" [model]="items" [disabled]="true"></p-splitButton>
</div>`,
</div>
<div class="card flex justify-content-center">
<p-toast></p-toast>
<p-splitButton label="Save" icon="pi pi-plus" (onClick)="save('info')" [model]="items" [menuButtonDisabled]="true"></p-splitButton>
</div>
`,

typescript: `
import { Component } from '@angular/core';
Expand Down

0 comments on commit 73a2c67

Please sign in to comment.