define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-inputs", "../base/util"], function (require, exports, ej2_base_1, ej2_inputs_1, util_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var NumericEditCell = (function () {
function NumericEditCell(parent) {
this.parent = parent;
}
NumericEditCell.prototype.keyEventHandler = function (args) {
Eif (args.keyCode === 13 || args.keyCode === 9) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent('change', false, true);
this.dispatchEvent(evt);
}
};
NumericEditCell.prototype.create = function (args) {
this.instances = new ej2_base_1.Internationalization(this.parent.locale);
return util_1.createEditElement(this.parent, args.column, 'e-field', {});
};
NumericEditCell.prototype.read = function (element) {
return this.obj.value;
};
NumericEditCell.prototype.write = function (args) {
var col = args.column;
var isInline = this.parent.editSettings.mode !== 'Dialog';
this.obj = new ej2_inputs_1.NumericTextBox(ej2_base_1.extend({
value: parseFloat(util_1.getObject(args.column.field, args.rowData)),
enableRtl: this.parent.enableRtl,
placeholder: isInline ? '' : args.column.headerText,
enabled: util_1.isEditable(args.column, args.requestType, args.element),
floatLabelType: this.parent.editSettings.mode !== 'Dialog' ? 'Never' : 'Always',
locale: this.parent.locale,
cssClass: this.parent.cssClass ? this.parent.cssClass : null
}, col.edit.params));
args.element.setAttribute('name', util_1.getComplexFieldID(args.column.field));
this.obj.appendTo(args.element);
this.obj.element.addEventListener('keydown', this.keyEventHandler);
};
NumericEditCell.prototype.destroy = function () {
if (this.obj && !this.obj.isDestroyed) {
this.obj.element.removeEventListener('keydown', this.keyEventHandler);
this.obj.destroy();
}
};
return NumericEditCell;
}());
exports.NumericEditCell = NumericEditCell;
});
|