all files / grid/renderer/ boolean-filter-ui.js

96.55% Statements 28/29
75% Branches 6/8
87.5% Functions 7/8
96.55% Lines 28/29
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 44 45 46 47 48 49 50 51                                              
define(["require", "exports", "../base/util", "@syncfusion/ej2-data", "@syncfusion/ej2-dropdowns", "@syncfusion/ej2-base"], function (require, exports, util_1, ej2_data_1, ej2_dropdowns_1, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var BooleanFilterUI = (function () {
        function BooleanFilterUI(parent, serviceLocator, filterSettings) {
            this.parent = parent;
            this.serviceLocator = serviceLocator;
            this.filterSettings = filterSettings;
        }
        BooleanFilterUI.prototype.create = function (args) {
            var isForeignColumn = args.column.isForeignColumn();
            var dataSource = isForeignColumn ? args.column.dataSource : this.parent.dataSource;
            var fields = isForeignColumn ? args.column.foreignKeyValue : args.column.field;
            this.elem = ej2_base_1.createElement('input', { className: 'e-flmenu-input', id: 'bool-ui-' + args.column.uid });
            args.target.appendChild(this.elem);
            this.dialogObj = args.dialogObj;
            this.dropInstance = new ej2_dropdowns_1.DropDownList({
                dataSource: dataSource instanceof ej2_data_1.DataManager ?
                    dataSource : new ej2_data_1.DataManager(dataSource),
                query: new ej2_data_1.Query().select(fields),
                fields: { text: fields, value: fields },
                placeholder: args.localizeText.getConstant('SelectValue'),
                cssClass: 'e-popup-flmenu',
                locale: this.parent.locale,
                enableRtl: this.parent.enableRtl,
                open: this.openPopup.bind(this),
                actionComplete: function (e) {
                    e.result = ej2_data_1.DataUtil.distinct(e.result, fields, true);
                }
            });
            this.dropInstance.appendTo(this.elem);
        };
        BooleanFilterUI.prototype.write = function (args) {
            var drpuiObj = document.querySelector('#bool-ui-' + args.column.uid).ej2_instances[0];
            if (!ej2_base_1.isNullOrUndefined(args.filteredValue)) {
                drpuiObj.text = args.filteredValue;
            }
        };
        BooleanFilterUI.prototype.read = function (element, column, filterOptr, filterObj) {
            var drpuiObj = document.querySelector('#bool-ui-' + column.uid).ej2_instances[0];
            var filterValue = drpuiObj.value;
            filterObj.filterByColumn(column.field, filterOptr, filterValue, 'and', false);
        };
        BooleanFilterUI.prototype.openPopup = function (args) {
            util_1.getZIndexCalcualtion(args, this.dialogObj);
        };
        return BooleanFilterUI;
    }());
    exports.BooleanFilterUI = BooleanFilterUI;
});