define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-calendars"], function (require, exports, ej2_base_1, ej2_calendars_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DatePickerDialog = (function () {
function DatePickerDialog(documentHelper) {
var _this = this;
this.onCancelButtonClick = function () {
_this.documentHelper.dialog.hide();
_this.documentHelper.updateFocus();
};
this.documentHelper = documentHelper;
}
DatePickerDialog.prototype.getModuleName = function () {
return 'DateContentDialog';
};
DatePickerDialog.prototype.initDateContentDialog = function (localValue) {
this.target = ej2_base_1.createElement('div');
this.parentDiv = ej2_base_1.createElement('div');
this.target.appendChild(this.parentDiv);
var calendar = new ej2_calendars_1.Calendar({
change: this.valueChange.bind(this)
});
Iif (this.documentHelper.owner.editor.dateValue) {
calendar.value = new Date(this.documentHelper.owner.editor.dateValue);
}
calendar.appendTo(this.parentDiv);
Iif (this.documentHelper.owner.editor.dateValue) {
calendar.value = new Date(this.documentHelper.owner.editor.dateValue);
}
};
DatePickerDialog.prototype.valueChange = function (args) {
if (args.event) {
var value = args.value.toLocaleDateString();
var contenControl = this.documentHelper.owner.editor.getContentControl();
this.documentHelper.owner.editor.dropDownChange(contenControl, value);
this.documentHelper.hideDialog();
}
};
DatePickerDialog.prototype.show = function () {
var localValue = new ej2_base_1.L10n('documenteditor', this.documentHelper.owner.defaultLocale);
localValue.setLocale(this.documentHelper.owner.locale);
this.localeValue = localValue;
Eif (!this.target) {
this.initDateContentDialog(localValue);
}
Eif (this.documentHelper.selection.caret.style.display !== 'none') {
this.documentHelper.selection.caret.style.display = 'none';
}
this.documentHelper.dialog.header = localValue.getConstant('Datepicker Content Control');
this.documentHelper.dialog.height = 'auto';
this.documentHelper.dialog.width = 'auto';
this.documentHelper.dialog.content = this.target;
this.documentHelper.dialog.beforeOpen = this.documentHelper.updateFocus;
this.documentHelper.dialog.close = this.documentHelper.updateFocus;
this.documentHelper.dialog.dataBind();
this.documentHelper.dialog.show();
};
DatePickerDialog.prototype.destroy = function () {
Iif (this.calendar) {
this.calendar.destroy();
this.calendar = undefined;
}
this.documentHelper = undefined;
if (this.parentDiv) {
this.parentDiv.remove();
this.parentDiv = undefined;
}
if (!ej2_base_1.isNullOrUndefined(this.target)) {
Iif (this.target.parentElement) {
this.target.parentElement.removeChild(this.target);
}
for (var i = 0; i < this.target.childNodes.length; i++) {
this.target.removeChild(this.target.childNodes[parseInt(i.toString(), 10)]);
i--;
}
this.target = undefined;
}
};
return DatePickerDialog;
}());
exports.DatePickerDialog = DatePickerDialog;
});
|