diff --git a/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts b/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts index 5b4be1dc6..fcf156dc5 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts @@ -77,6 +77,7 @@ const TEXT = { ], WarnTake: ["꺼낼 칸을 고르지 않음", "No column to take"], Count: ["선", "Line"], + Range: ["{n} (범위)", "{n} (range)"], } as const; const tk = (key: keyof typeof TEXT, n?: number | string): string => @@ -174,13 +175,25 @@ function lookupEditor(ctx: Ctx, rule: Extract): HTML ...new Set([...ctx.headers, ...rule.conds.map((c) => c.col), rule.col].filter(Boolean)), ]; const colOpts = cols.map((c) => ({ value: c, text: c })); + // 조건 칸 — 「이름·아래」 「이름·위」 짝은 「이름 (범위)」 한 줄(고르면 칸 이름 = 이름 · Rule 이 아래 < 값 ≤ 위 로 찾음) + const range = (c: string): string | null => { + const m = /^(.+)·(아래|위)$/.exec(c); + return m && cols.includes(`${m[1]}·아래`) && cols.includes(`${m[1]}·위`) ? m[1] : null; + }; + const condOpts = [ + ...cols.filter((c) => !range(c)).map((c) => ({ value: c, text: c })), + ...[...new Set(cols.map(range).filter((x): x is string => !!x))].map((x) => ({ + value: x, + text: tk("Range", x), + })), + ]; const pills = pillOptions(ctx); const put = (next: Partial): void => setRule(ctx, { ...rule, ...next }); const rows = rule.conds.map((c, i) => row( select( ctx, - colOpts, + condOpts, c.col, (v) => put({ conds: rule.conds.map((x, j) => (j === i ? { ...x, col: v } : x)) }), tk("Col"), @@ -211,9 +224,11 @@ function lookupEditor(ctx: Ctx, rule: Extract): HTML label: tk("AddCond"), variant: "ghost", size: "sm", - disabled: !pills.length || !cols.length, + disabled: !pills.length || !condOpts.length, onClick: () => - put({ conds: [...rule.conds, { col: cols[0], from: fromKey(pills[0].value) }] }), + put({ + conds: [...rule.conds, { col: condOpts[0].value, from: fromKey(pills[0].value) }], + }), }), ), );