fix(M02-흐름도): 선 규칙 표에서 찾기 - 범위 이름은 이름 (범위) 한 줄만 · 꺼낼 칸은 표 머리 칸만
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D2nUMUMTsqm93PbQtipo6c
This commit is contained in:
@@ -171,21 +171,18 @@ const row = (...children: (HTMLElement | string)[]): HTMLElement =>
|
||||
/* ── 규칙마다 ─────────────────────────────────────────────────────────── */
|
||||
|
||||
function lookupEditor(ctx: Ctx, rule: Extract<CfRule, { kind: "lookup" }>): HTMLElement[] {
|
||||
const cols = [
|
||||
...new Set([...ctx.headers, ...rule.conds.map((c) => c.col), rule.col].filter(Boolean)),
|
||||
];
|
||||
// 꺼낼 칸 = 표 머리 칸만
|
||||
const cols = [...new Set([...ctx.headers, rule.col].filter(Boolean))];
|
||||
const colOpts = cols.map((c) => ({ value: c, text: c }));
|
||||
// 조건 칸 — 「이름·아래」 「이름·위」 짝은 「이름 (범위)」 한 줄(고르면 칸 이름 = 이름 · Rule 이 아래 < 값 ≤ 위 로 찾음)
|
||||
// 조건 칸 — 「이름·아래」 「이름·위」 짝은 「이름 (범위)」 한 줄만(고르면 칸 이름 = 이름 · 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 bases = [...new Set(cols.map(range).filter((x): x is string => !!x))];
|
||||
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),
|
||||
})),
|
||||
...cols.filter((c) => !range(c) && !bases.includes(c)).map((c) => ({ value: c, text: c })),
|
||||
...bases.map((x) => ({ value: x, text: tk("Range", x) })),
|
||||
];
|
||||
const pills = pillOptions(ctx);
|
||||
const put = (next: Partial<typeof rule>): void => setRule(ctx, { ...rule, ...next });
|
||||
|
||||
Reference in New Issue
Block a user