e.stopPropagation()}>
{
if (isSubVariableKey)
@@ -190,6 +193,17 @@ const ConditionItem = ({
onRemoveCondition?.(caseId, condition.id)
}, [caseId, condition, conditionId, isSubVariableKey, onRemoveCondition, onRemoveSubVariableCondition])
+ const handleVarChange = useCallback((valueSelector: ValueSelector, varItem: Var) => {
+ const newCondition = produce(condition, (draft) => {
+ draft.variable_selector = valueSelector
+ draft.varType = varItem.type
+ draft.value = ''
+ draft.comparison_operator = getOperators(varItem.type)[0]
+ })
+ doUpdateCondition(newCondition)
+ setOpen(false)
+ }, [condition, doUpdateCondition])
+
return (
)
: (
-
)}
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-var-selector.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-var-selector.tsx
new file mode 100644
index 0000000000..68a012d1a0
--- /dev/null
+++ b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-var-selector.tsx
@@ -0,0 +1,58 @@
+import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '@/app/components/base/portal-to-follow-elem'
+import VariableTag from '@/app/components/workflow/nodes/_base/components/variable-tag'
+import VarReferenceVars from '@/app/components/workflow/nodes/_base/components/variable/var-reference-vars'
+import type { Node, NodeOutPutVar, ValueSelector, Var, VarType } from '@/app/components/workflow/types'
+
+type ConditionVarSelectorProps = {
+ open: boolean
+ onOpenChange: (open: boolean) => void
+ valueSelector: ValueSelector
+ varType: VarType
+ availableNodes: Node[]
+ nodesOutputVars: NodeOutPutVar[]
+ onChange: (valueSelector: ValueSelector, varItem: Var) => void
+}
+
+const ConditionVarSelector = ({
+ open,
+ onOpenChange,
+ valueSelector,
+ varType,
+ availableNodes,
+ nodesOutputVars,
+ onChange,
+}: ConditionVarSelectorProps) => {
+ return (
+
+ onOpenChange(!open)}>
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default ConditionVarSelector
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-value.tsx b/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
index 182e38f71e..792064e6ed 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
@@ -73,7 +73,7 @@ const ConditionValue = ({