define(["require", "exports", "@syncfusion/ej2-inputs", "@syncfusion/ej2-base", "../base/constant"], function (require, exports, ej2_inputs_1, ej2_base_1, events) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var NumberFilterUI = (function () {
function NumberFilterUI(parent, serviceLocator, filterSettings) {
this.filterSettings = filterSettings;
this.parent = parent;
this.serviceLocator = serviceLocator;
Eif (this.parent) {
this.parent.on(events.filterMenuClose, this.destroy, this);
this.parent.on(events.destroy, this.destroy, this);
}
}
NumberFilterUI.prototype.keyEventHandler = function (args) {
Eif (args.keyCode === 13 || args.keyCode === 9) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent('change', false, true);
this.dispatchEvent(evt);
}
};
NumberFilterUI.prototype.create = function (args) {
this.instance = this.parent.createElement('input', { className: 'e-flmenu-input', id: 'numberui-' + args.column.uid });
args.target.appendChild(this.instance);
this.numericTxtObj = new ej2_inputs_1.NumericTextBox(ej2_base_1.extend({
format: typeof (args.column.format) === 'string' || ej2_base_1.isUndefined(args.column.format) ? args.column.format :
args.column.format.format,
locale: this.parent.locale,
cssClass: this.parent.cssClass ? 'e-popup-flmenu' + ' ' + this.parent.cssClass : 'e-popup-flmenu',
placeholder: args.localizeText.getConstant('EnterValue'),
enableRtl: this.parent.enableRtl
}, args.column.filter.params));
this.numericTxtObj.appendTo(this.instance);
};
NumberFilterUI.prototype.write = function (args) {
var numberuiObj = document.querySelector('#numberui-' + args.column.uid).ej2_instances[0];
numberuiObj.element.addEventListener('keydown', this.keyEventHandler);
numberuiObj.value = args.filteredValue;
};
NumberFilterUI.prototype.read = function (element, column, filterOptr, filterObj) {
var numberuiObj = document.querySelector('#numberui-' + column.uid).ej2_instances[0];
var filterValue = numberuiObj.value;
filterObj.filterByColumn(column.field, filterOptr, filterValue, 'and', true);
};
NumberFilterUI.prototype.destroy = function () {
if (!this.numericTxtObj || this.numericTxtObj.isDestroyed) {
return;
}
this.numericTxtObj.destroy();
this.parent.off(events.filterMenuClose, this.destroy);
this.parent.off(events.destroy, this.destroy);
};
return NumberFilterUI;
}());
exports.NumberFilterUI = NumberFilterUI;
});
|