UNPKG

armisa-models

Version:
58 lines (57 loc) 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FilterBoolean = void 0; const FilterBase_1 = require("./FilterBase"); class FilterBoolean extends FilterBase_1.FilterBase { get keyOfMethod() { return `${this.key}Method`; } set keyOfMethod(value) { } constructor(key, method, from, to, list) { super(); this.key = key; this.method = method; this.from = from; this.to = to; this.list = list; this.getFilter = () => { if (typeof this.from === 'boolean') { return this.from; } return undefined; }; this.setMethodValue = (value) => { switch (value) { case 0: this.method = 'equal'; break; default: this.method = undefined; break; } }; this.getMethodValue = () => { return this.method === 'from' ? 1 : 0; }; this.isFiltered = () => { if (typeof this.from !== 'undefined' && typeof this.from === 'boolean') { return true; } return false; }; this.clearFilter = () => { this.method = undefined; this.from = undefined; this.to = undefined; this.list = undefined; this.multiItemTimer && clearTimeout(this.multiItemTimer); this.multiItemTimer = undefined; this.multiItem = undefined; this.itemOfListValue = undefined; }; } static empty(key, from) { return new FilterBoolean(key, 'equal', from, undefined, undefined); } } exports.FilterBoolean = FilterBoolean;