Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
event.preventDefault();
}
this.onHide.emit(this);
// todo: add an option to prevent hiding
if (!this._isShown) {
return;
}
clearTimeout(this.timerHideModal);
clearTimeout(this.timerRmBackDrop);
this._isShown = false;
this._renderer.removeClass(this._element.nativeElement, CLASS_NAME.IN);
if (!isBs3()) {
this._renderer.removeClass(this._element.nativeElement, CLASS_NAME.SHOW);
}
// this._addClassIn = false;
if (this._config.animated) {
this.timerHideModal = setTimeout(
() => this.hideModal(),
TRANSITION_DURATION
);
} else {
this.hideModal();
}
}
get isBs3(): boolean {
return isBs3();
}
get isBs3(): boolean {
return isBs3();
}
hide(): void {
if (this.isModalHiding || !this.isShown) {
return;
}
this.isModalHiding = true;
this._renderer.removeClass(
this._element.nativeElement,
isBs3() ? CLASS_NAME.IN : CLASS_NAME.SHOW
);
setTimeout(() => {
this.isShown = false;
if (
document &&
document.body &&
this.bsModalService.getModalsCount() === 1
) {
this._renderer.removeClass(document.body, CLASS_NAME.OPEN);
}
this.bsModalService.hide(this.level);
this.isModalHiding = false;
}, this.isAnimated ? TRANSITION_DURATIONS.MODAL : 0);
}
}
set isShown(value: boolean) {
this._isShown = value;
if (value) {
this.renderer.addClass(
this.element.nativeElement,
`${CLASS_NAME.IN}`
);
} else {
this.renderer.removeClass(
this.element.nativeElement,
`${CLASS_NAME.IN}`
);
}
if (!isBs3()) {
if (value) {
this.renderer.addClass(
this.element.nativeElement,
`${CLASS_NAME.SHOW}`
);
} else {
this.renderer.removeClass(
this.element.nativeElement,
`${CLASS_NAME.SHOW}`
);
}
}
}
get isBs3(): boolean {
return isBs3();
}
get isBs4(): boolean {
return !isBs3();
}
get isBs3(): boolean {
return isBs3();
}
get isBs4(): boolean {
return !isBs3();
}