|
|
@ -27,8 +27,13 @@ export class ModalComponent implements OnDestroy { |
|
|
return this._visible; |
|
|
return this._visible; |
|
|
} |
|
|
} |
|
|
set visible(value: boolean) { |
|
|
set visible(value: boolean) { |
|
|
|
|
|
if (typeof value !== 'boolean') return; |
|
|
|
|
|
|
|
|
if (!this.modalContent) { |
|
|
if (!this.modalContent) { |
|
|
setTimeout(() => (this.visible = value), 0); |
|
|
setTimeout(() => { |
|
|
|
|
|
this.showModal = value; |
|
|
|
|
|
this.visible = value; |
|
|
|
|
|
}, 0); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -40,7 +45,7 @@ export class ModalComponent implements OnDestroy { |
|
|
this.renderer.addClass(this.modalContent.nativeElement, 'fade-out-top'); |
|
|
this.renderer.addClass(this.modalContent.nativeElement, 'fade-out-top'); |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
this.setVisible(value); |
|
|
this.setVisible(value); |
|
|
this.renderer.removeClass(this.modalContent.nativeElement, 'fade-out-top'); |
|
|
// this.renderer.removeClass(this.modalContent.nativeElement, 'fade-out-top');
|
|
|
this.ngOnDestroy(); |
|
|
this.ngOnDestroy(); |
|
|
}, 350); |
|
|
}, 350); |
|
|
} |
|
|
} |
|
|
@ -66,10 +71,12 @@ export class ModalComponent implements OnDestroy { |
|
|
|
|
|
|
|
|
_visible: boolean = false; |
|
|
_visible: boolean = false; |
|
|
|
|
|
|
|
|
closable: boolean = false; |
|
|
showModal: boolean = false; |
|
|
|
|
|
|
|
|
isOpenConfirmation: boolean = false; |
|
|
isOpenConfirmation: boolean = false; |
|
|
|
|
|
|
|
|
|
|
|
closable: boolean = false; |
|
|
|
|
|
|
|
|
destroy$ = new Subject<void>(); |
|
|
destroy$ = new Subject<void>(); |
|
|
|
|
|
|
|
|
constructor(private renderer: Renderer2, private confirmationService: ConfirmationService) {} |
|
|
constructor(private renderer: Renderer2, private confirmationService: ConfirmationService) {} |
|
|
@ -81,6 +88,8 @@ export class ModalComponent implements OnDestroy { |
|
|
setVisible(value: boolean) { |
|
|
setVisible(value: boolean) { |
|
|
this._visible = value; |
|
|
this._visible = value; |
|
|
this.visibleChange.emit(value); |
|
|
this.visibleChange.emit(value); |
|
|
|
|
|
this.showModal = value; |
|
|
|
|
|
|
|
|
value |
|
|
value |
|
|
? timer(500) |
|
|
? timer(500) |
|
|
.pipe(take(1)) |
|
|
.pipe(take(1)) |
|
|
@ -93,14 +102,16 @@ export class ModalComponent implements OnDestroy { |
|
|
.pipe( |
|
|
.pipe( |
|
|
debounceTime(350), |
|
|
debounceTime(350), |
|
|
takeUntil(this.destroy$), |
|
|
takeUntil(this.destroy$), |
|
|
filter( |
|
|
filter((event: MouseEvent) => { |
|
|
(event: MouseEvent) => |
|
|
const isOpenConfirmation = this.isOpenConfirmation || document.querySelector('p-toastitem'); |
|
|
|
|
|
return ( |
|
|
event && |
|
|
event && |
|
|
this.closable && |
|
|
this.closable && |
|
|
this.modalContent && |
|
|
this.modalContent && |
|
|
!this.isOpenConfirmation && |
|
|
!isOpenConfirmation && |
|
|
!this.modalContent.nativeElement.contains(event.target), |
|
|
!this.modalContent.nativeElement.contains(event.target) |
|
|
), |
|
|
); |
|
|
|
|
|
}), |
|
|
) |
|
|
) |
|
|
.subscribe(_ => { |
|
|
.subscribe(_ => { |
|
|
this.close(); |
|
|
this.close(); |
|
|
|