import { CompareType } from '../enum/compare-type.enum'; import { ValueType } from '../enum/value-type.enum'; import { RelationType } from '../enum/relation-type.enum'; export class InputGroupHandler { convert(qc) { const igv = (qc.value); const arr = []; if(igv.textValue && igv.textValue.length == 0 ){ return []; } else if (igv.isInputText) { arr.push({ 'FilterField': qc.labelCode, 'Compare': CompareType.Like, // 'Value': encodeURIComponent(igv.textValue), 'Value': igv.textValue, 'Relation': RelationType.And, 'Expresstype': ValueType.Value }); return arr; } else { igv.getOriginalValue().split(',').forEach(itemValue => { itemValue && arr.push({ 'FilterField': qc.labelCode, 'Compare': CompareType.Equal, 'Value': itemValue, 'Relation': RelationType.Or, 'Expresstype': ValueType.Value }); }); if (arr.length > 0) { arr[0]['Lbracket'] = '('; arr[arr.length - 1]['Rbracket'] = ')'; arr[arr.length - 1]['Relation'] = RelationType.And; return arr; } else { return []; } } } }