import { CompareType } from '../enum/compare-type.enum'; import { ValueType } from '../enum/value-type.enum'; import { RelationType } from '../enum/relation-type.enum'; export class FlexibleNumberHandler{ convert(qc) { const arr = []; const nrv = (qc.value); if(qc.control.single){ return Object.keys(nrv).length > 0 && nrv.value != null ? [{ 'FilterField' : qc.labelCode, 'Compare' : CompareType.Equal, 'Value' : nrv.value, 'Relation' : RelationType.And, 'Expresstype':ValueType.Value }] : []; } else{ if(Object.keys(nrv).length === 0) return arr; (nrv.startValue != null) && arr.push({ 'FilterField' : qc.labelCode, 'Compare' : CompareType.GreaterThanOrEqual, //GreaterOrEqual 'Value' : nrv.startValue, 'Relation' : RelationType.And, //and 'Expresstype': ValueType.Value }); (nrv.endValue != null) && arr.push({ 'FilterField' : qc.labelCode, 'Compare' : CompareType.LessThanOrEqual, //LessOrEqual 'Value' : nrv.endValue, 'Relation' : RelationType.And,//and 'Expresstype': ValueType.Value }); return arr; } } }