diff --git a/src/app/components/splitbutton/splitbutton.ts b/src/app/components/splitbutton/splitbutton.ts index afee3a2f0c4..6dcb1ff7539 100755 --- a/src/app/components/splitbutton/splitbutton.ts +++ b/src/app/components/splitbutton/splitbutton.ts @@ -93,7 +93,8 @@ type SplitButtonIconPosition = 'left' | 'right'; [appendTo]="appendTo" [showTransitionOptions]="showTransitionOptions" [hideTransitionOptions]="hideTransitionOptions" - (onHide)="isExpanded.set(false)" + (onHide)="onHide()" + (onShow)="onShow()" > `, @@ -276,6 +277,16 @@ export class SplitButton { * @group Emits */ @Output() onClick: EventEmitter = new EventEmitter(); + /** + * Callback to invoke when overlay menu is hidden. + * @group Emits + */ + @Output() onMenuHide: EventEmitter = new EventEmitter(); + /** + * Callback to invoke when overlay menu is shown. + * @group Emits + */ + @Output() onMenuShow: EventEmitter = new EventEmitter(); /** * Callback to invoke when dropdown button is clicked. * @param {MouseEvent} event - Mouse event. @@ -348,7 +359,6 @@ export class SplitButton { onDropdownButtonClick(event?: MouseEvent) { this.onDropdownClick.emit(event); this.menu?.toggle({ currentTarget: this.containerViewChild?.nativeElement, relativeAlign: this.appendTo == null }); - this.isExpanded.set(this.menu.visible); } onDropdownButtonKeydown(event: KeyboardEvent) { @@ -357,6 +367,16 @@ export class SplitButton { event.preventDefault(); } } + + onHide() { + this.isExpanded.set(false); + this.onMenuHide.emit(); + } + + onShow() { + this.isExpanded.set(true); + this.onMenuShow.emit(); + } } @NgModule({