테이블에 존재하는지 확인하는 제어 추가

This commit is contained in:
kjs
2026-01-07 09:55:19 +09:00
parent c365f06ed7
commit e308fd0ccc
4 changed files with 659 additions and 119 deletions

View File

@@ -22,6 +22,13 @@ const OPERATOR_LABELS: Record<string, string> = {
NOT_IN: "NOT IN",
IS_NULL: "NULL",
IS_NOT_NULL: "NOT NULL",
EXISTS_IN: "EXISTS IN",
NOT_EXISTS_IN: "NOT EXISTS IN",
};
// EXISTS 계열 연산자인지 확인
const isExistsOperator = (operator: string): boolean => {
return operator === "EXISTS_IN" || operator === "NOT_EXISTS_IN";
};
export const ConditionNode = memo(({ data, selected }: NodeProps<ConditionNodeData>) => {
@@ -54,15 +61,31 @@ export const ConditionNode = memo(({ data, selected }: NodeProps<ConditionNodeDa
{idx > 0 && (
<div className="mb-1 text-center text-xs font-semibold text-yellow-600">{data.logic}</div>
)}
<div className="flex items-center gap-1">
<div className="flex flex-wrap items-center gap-1">
<span className="font-mono text-gray-700">{condition.field}</span>
<span className="rounded bg-yellow-200 px-1 py-0.5 text-yellow-800">
<span
className={`rounded px-1 py-0.5 ${
isExistsOperator(condition.operator)
? "bg-purple-200 text-purple-800"
: "bg-yellow-200 text-yellow-800"
}`}
>
{OPERATOR_LABELS[condition.operator] || condition.operator}
</span>
{condition.value !== null && condition.value !== undefined && (
<span className="text-gray-600">
{typeof condition.value === "string" ? `"${condition.value}"` : String(condition.value)}
{/* EXISTS 연산자인 경우 테이블.필드 표시 */}
{isExistsOperator(condition.operator) ? (
<span className="text-purple-600">
{(condition as any).lookupTableLabel || (condition as any).lookupTable || "..."}
{(condition as any).lookupField && `.${(condition as any).lookupFieldLabel || (condition as any).lookupField}`}
</span>
) : (
// 일반 연산자인 경우 값 표시
condition.value !== null &&
condition.value !== undefined && (
<span className="text-gray-600">
{typeof condition.value === "string" ? `"${condition.value}"` : String(condition.value)}
</span>
)
)}
</div>
</div>