Skip to content

Commit

Permalink
Merge pull request #12566 from primefaces/issue-12564
Browse files Browse the repository at this point in the history
Fixed #12564 - Sidebar: onHide ist emitted twice
  • Loading branch information
cetincakiroglu authored Jan 27, 2023
2 parents 945d9a5 + dc84d1e commit da81756
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/app/components/sidebar/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { animate, animation, style, transition, trigger, useAnimation } from '@angular/animations';
import { CommonModule } from '@angular/common';
import {
NgModule,
Component,
AfterContentInit,
AfterViewInit,
OnDestroy,
Input,
Output,
EventEmitter,
ElementRef,
Renderer2,
ChangeDetectionStrategy,
ViewEncapsulation,
ChangeDetectorRef,
Component,
ContentChildren,
ElementRef,
EventEmitter,
Input,
NgModule,
OnDestroy,
Output,
QueryList,
AfterContentInit,
Renderer2,
TemplateRef,
ChangeDetectorRef
ViewEncapsulation
} from '@angular/core';
import { trigger, style, transition, animate, animation, useAnimation } from '@angular/animations';
import { CommonModule } from '@angular/common';
import { RippleModule } from 'primeng/ripple';
import { DomHandler } from 'primeng/dom';
import { PrimeNGConfig, PrimeTemplate } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
import { RippleModule } from 'primeng/ripple';
import { ZIndexUtils } from 'primeng/utils';

const showAnimation = animation([style({ transform: '{{transform}}', opacity: 0 }), animate('{{transition}}')]);
Expand Down Expand Up @@ -211,8 +211,10 @@ export class Sidebar implements AfterViewInit, AfterContentInit, OnDestroy {
this.visibleChange.emit(true);
}

hide() {
this.onHide.emit({});
hide(emit: boolean = true) {
if (emit) {
this.onHide.emit({});
}

if (this.modal) {
this.disableModality();
Expand Down Expand Up @@ -286,7 +288,7 @@ export class Sidebar implements AfterViewInit, AfterContentInit, OnDestroy {
onAnimationEnd(event) {
switch (event.toState) {
case 'void':
this.hide();
this.hide(false);
ZIndexUtils.clear(this.container);
this.unbindGlobalListeners();
break;
Expand Down

0 comments on commit da81756

Please sign in to comment.