all files / grid/actions/ checkbox-filter.js

95.92% Statements 47/49
100% Branches 8/8
86.67% Functions 13/15
95.92% Lines 47/49
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70   163× 163× 163× 163×   220× 220×   109× 109×   170× 170× 86×           154×   358×   147×           164×   163× 163× 163×   220× 25×   195× 195× 195×        
define(["require", "exports", "../base/constant", "../base/util", "../common/checkbox-filter-base"], function (require, exports, events, util_1, checkbox_filter_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CheckBoxFilter = (function () {
        function CheckBoxFilter(parent, filterSettings, serviceLocator) {
            this.parent = parent;
            this.isresetFocus = true;
            this.checkBoxBase = new checkbox_filter_base_1.CheckBoxFilterBase(parent);
            this.addEventListener();
        }
        CheckBoxFilter.prototype.destroy = function () {
            this.removeEventListener();
            this.checkBoxBase.closeDialog();
        };
        CheckBoxFilter.prototype.openDialog = function (options) {
            this.checkBoxBase.openDialog(options);
            this.parent.log('column_type_missing', { column: options.column });
        };
        CheckBoxFilter.prototype.closeDialog = function () {
            this.destroy();
            if (this.isresetFocus) {
                this.parent.notify(events.restoreFocus, {});
            }
        };
        CheckBoxFilter.prototype.closeResponsiveDialog = function () {
            this.checkBoxBase.closeDialog();
        };
        CheckBoxFilter.prototype.getModuleName = function () {
            return 'checkboxFilter';
        };
        CheckBoxFilter.prototype.actionBegin = function (args) {
            this.parent.trigger(events.actionBegin, args);
        };
        CheckBoxFilter.prototype.actionComplete = function (args) {
            this.parent.trigger(events.actionComplete, args);
        };
        CheckBoxFilter.prototype.actionPrevent = function (args) {
            if (util_1.isActionPrevent(this.parent)) {
                this.parent.notify(events.preventBatch, args);
                args.cancel = true;
            }
        };
        CheckBoxFilter.prototype.clearCustomFilter = function (col) {
            this.checkBoxBase.clearFilter(col);
        };
        CheckBoxFilter.prototype.applyCustomFilter = function () {
            this.checkBoxBase.fltrBtnHandler();
            this.checkBoxBase.closeDialog();
        };
        CheckBoxFilter.prototype.addEventListener = function () {
            if (this.parent.isDestroyed) {
                return;
            }
            this.parent.on(events.cBoxFltrBegin, this.actionBegin, this);
            this.parent.on(events.cBoxFltrComplete, this.actionComplete, this);
            this.parent.on(events.fltrPrevent, this.actionPrevent, this);
        };
        CheckBoxFilter.prototype.removeEventListener = function () {
            if (this.parent.isDestroyed) {
                return;
            }
            this.parent.off(events.cBoxFltrBegin, this.actionBegin);
            this.parent.off(events.cBoxFltrComplete, this.actionComplete);
            this.parent.off(events.fltrPrevent, this.actionPrevent);
        };
        return CheckBoxFilter;
    }());
    exports.CheckBoxFilter = CheckBoxFilter;
});