ngx-bootstrap
Version:
Native Angular Bootstrap Components
69 lines • 2.58 kB
JavaScript
import { Component, ElementRef, Renderer2 } from '@angular/core';
import { CLASS_NAME } from './modal-options.class';
import { isBs3 } from '../utils/theme-provider';
import { Utils } from '../utils/utils.class';
/** This component will be added as background layout for modals if enabled */
var ModalBackdropComponent = /** @class */ (function () {
function ModalBackdropComponent(element, renderer) {
this._isShown = false;
this.element = element;
this.renderer = renderer;
}
Object.defineProperty(ModalBackdropComponent.prototype, "isAnimated", {
get: function () {
return this._isAnimated;
},
set: function (value) {
this._isAnimated = value;
// this.renderer.setElementClass(this.element.nativeElement, `${ClassName.FADE}`, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ModalBackdropComponent.prototype, "isShown", {
get: function () {
return this._isShown;
},
set: function (value) {
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);
}
}
},
enumerable: true,
configurable: true
});
ModalBackdropComponent.prototype.ngOnInit = function () {
if (this.isAnimated) {
this.renderer.addClass(this.element.nativeElement, "" + CLASS_NAME.FADE);
Utils.reflow(this.element.nativeElement);
}
this.isShown = true;
};
ModalBackdropComponent.decorators = [
{ type: Component, args: [{
selector: 'bs-modal-backdrop',
template: ' ',
host: { class: CLASS_NAME.BACKDROP }
},] },
];
/** @nocollapse */
ModalBackdropComponent.ctorParameters = function () { return [
{ type: ElementRef, },
{ type: Renderer2, },
]; };
return ModalBackdropComponent;
}());
export { ModalBackdropComponent };
//# sourceMappingURL=modal-backdrop.component.js.map