all files / grid/renderer/ numeric-edit-cell.js

100% Statements 22/22
87.5% Branches 7/8
100% Functions 7/7
100% Lines 22/22
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43   40×   39× 39×             27× 27×   39× 39× 39×             39× 39×   33× 33×          
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-inputs", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, ej2_inputs_1, util_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var NumericEditCell = (function () {
        function NumericEditCell(parent) {
            this.parent = parent;
        }
        NumericEditCell.prototype.create = function (args) {
            var complexFieldName = util_1.getComplexFieldID(args.column.field);
            return ej2_base_2.createElement('input', {
                className: 'e-field', attrs: {
                    id: this.parent.element.id + complexFieldName,
                    name: complexFieldName, 'e-mappinguid': args.column.uid
                }
            });
        };
        NumericEditCell.prototype.read = function (element) {
            element.blur();
            return element.ej2_instances[0].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',
            }, col.edit.params));
            this.obj.appendTo(args.element);
            args.element.setAttribute('name', util_1.getComplexFieldID(args.column.field));
        };
        NumericEditCell.prototype.destroy = function () {
            Eif (this.obj && !this.obj.isDestroyed) {
                this.obj.destroy();
            }
        };
        return NumericEditCell;
    }());
    exports.NumericEditCell = NumericEditCell;
});