define(["require", "exports", "@syncfusion/ej2-base", "../base/css-constant", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, cls, ej2_popups_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ErrorDialog = (function () {
function ErrorDialog(parent) {
this.parent = parent;
}
ErrorDialog.prototype.createErrorDialog = function (title, description) {
var errorDialog = ej2_base_1.createElement('div', {
id: this.parent.parentID + '_ErrorDialog',
className: cls.ERROR_DIALOG_CLASS
});
this.parent.element.appendChild(errorDialog);
this.errorPopUp = new ej2_popups_1.Dialog({
animationSettings: { effect: 'Fade' },
allowDragging: false,
header: title,
content: description,
isModal: true,
visible: true,
showCloseIcon: true,
enableRtl: this.parent.enableRtl,
enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
width: 'auto',
height: 'auto',
position: { X: 'center', Y: 'center' },
buttons: [
{
click: this.closeErrorDialog.bind(this),
isFlat: false,
buttonModel: { cssClass: cls.OK_BUTTON_CLASS + (this.parent.cssClass ? (' ' + this.parent.cssClass) : ''), content: this.parent.localeObj.getConstant('ok'), isPrimary: true }
}
],
cssClass: this.parent.cssClass,
closeOnEscape: true,
target: document.body,
close: this.removeErrorDialog.bind(this)
});
this.errorPopUp.isStringTemplate = true;
this.errorPopUp.appendTo(errorDialog);
};
ErrorDialog.prototype.closeErrorDialog = function () {
this.errorPopUp.close();
};
ErrorDialog.prototype.removeErrorDialog = function () {
if (this.errorPopUp && !this.errorPopUp.isDestroyed) {
this.errorPopUp.destroy();
this.errorPopUp = null;
}
if (document.getElementById(this.parent.parentID + '_ErrorDialog')) {
ej2_base_1.remove(document.getElementById(this.parent.parentID + '_ErrorDialog'));
}
};
return ErrorDialog;
}());
exports.ErrorDialog = ErrorDialog;
});
|