diff --git a/packages/builder/src/components/design/settings/controls/TableConditionEditor.svelte b/packages/builder/src/components/design/settings/controls/TableConditionEditor.svelte index b75a4358aa..0d93d3dc1d 100644 --- a/packages/builder/src/components/design/settings/controls/TableConditionEditor.svelte +++ b/packages/builder/src/components/design/settings/controls/TableConditionEditor.svelte @@ -53,17 +53,8 @@ $: count = value?.length $: conditionText = `${count || "No"} condition${count !== 1 ? "s" : ""} set` $: type = componentInstance.columnType - $: invalidType = Constants.BannedSearchTypes.includes(type) - $: valueTypeOptions = [ - { - label: "Binding", - value: FieldType.STRING, - }, - { - label: "Value", - value: type, - }, - ] + $: valueTypeOptions = getValueTypeOptions(type) + $: hasValueOption = type !== FieldType.STRING $: operatorOptions = QueryUtils.getValidOperatorsForType({ type, @@ -72,6 +63,22 @@ formulaType: FormulaType.STATIC, }) + const getValueTypeOptions = type => { + let options = [ + { + label: "Binding", + value: FieldType.STRING, + }, + ] + if (type !== FieldType.STRING) { + options.push({ + label: "Value", + value: type, + }) + } + return options + } + const openDrawer = () => { tempValue = cloneDeep(value || []) drawer.show() @@ -87,7 +94,7 @@ id: generate(), target: targetOptions[0].value, metadataKey: conditionOptions[0].value, - operator: Constants.OperatorOptions.Equals.value, + operator: operatorOptions[0]?.value, valueType: FieldType.STRING, } tempValue = [...tempValue, condition] @@ -158,6 +165,7 @@