From 9ec240cb462c300acd55b2b1efb67e880ae15605 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Fri, 2 Oct 2026 00:17:57 +0900 Subject: [PATCH] =?UTF-8?q?fix(M02-=ED=9D=90=EB=A6=84=EB=8F=84):=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=A4=84=20=EC=83=88=20=EC=A4=84=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EA=B0=92=EC=9D=80=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=B2=AB=20=EA=B0=92(=EC=86=8D=20=EA=B8=80=20=EC=95=88=20?= =?UTF-8?q?=EB=B3=B4=EC=9E=84)=20=C2=B7=20=EC=A1=B0=EA=B1=B4=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0=20=EB=AA=A9=EB=A1=9D=EC=97=90=20=EB=82=98?= =?UTF-8?q?=EC=A4=91=EC=97=90=20=EB=86=93=EC=9D=80=20=EC=95=8C=EC=95=BD=20?= =?UTF-8?q?=C2=B7=20=EB=B3=80=EC=88=98=EB=8F=84=20=EB=9C=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01D2nUMUMTsqm93PbQtipo6c --- M02_MasterTemplete/DataFlow/M02_DF_FuncExtra.ts | 7 +++++-- M02_MasterTemplete/DataFlow/M02_DF_FuncPanel.ts | 2 +- M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/M02_MasterTemplete/DataFlow/M02_DF_FuncExtra.ts b/M02_MasterTemplete/DataFlow/M02_DF_FuncExtra.ts index 6d302fea5..02a8c2cc0 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_FuncExtra.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_FuncExtra.ts @@ -60,10 +60,12 @@ export function drawCells(host: HTMLElement, x: ExtraContext): void { }); } -/** 우클릭 「조건 만들기」 에 주는 것 — 칸에 올 값 목록(알약이면 valueChoices · 변수면 고르기 목록) · 이름 붙은 칸 */ -export function conditionsOf(x: ExtraContext): ConditionOptions { +/** 우클릭 「조건 만들기」 에 주는 것 — 칸에 올 값 목록(알약이면 valueChoices · 변수면 고르기 목록) · 이름 붙은 칸 + * get 으로 부를 때마다 지금 상태를 다시 읽음(나중에 놓은 알약 · 만든 변수도 목록에 뜸) */ +export function conditionsOf(get: () => ExtraContext): ConditionOptions { return { valuesFor: (a1) => { + const x = get(); const f = boxOf(x)?.func; const at = a1.toUpperCase(); const v = f?.variables.find((y) => y.cell?.toUpperCase() === at); @@ -75,6 +77,7 @@ export function conditionsOf(x: ExtraContext): ConditionOptions { return link ? valueChoices(x.lg, link.from, { values: x.detail.values }) : null; }, pills: () => { + const x = get(); const f = boxOf(x)?.func; return [ ...(f?.inputs ?? []).filter((i) => i.cell).map((i) => ({ name: i.port, cell: i.cell })), diff --git a/M02_MasterTemplete/DataFlow/M02_DF_FuncPanel.ts b/M02_MasterTemplete/DataFlow/M02_DF_FuncPanel.ts index 17f9cb13a..437d1d532 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_FuncPanel.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_FuncPanel.ts @@ -583,7 +583,7 @@ async function mountSheet(st: State): Promise { preview: true, tabs: false, readOnly: st.readOnly, - conditions: conditionsOf(extra(st)), + conditions: conditionsOf(() => extra(st)), onChange: (b) => onBook(st, b), onSelect: (s) => { st.cell = s.칸; diff --git a/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts b/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts index f8efa089d..ac81f785a 100644 --- a/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts +++ b/M02_MasterTemplete/DataFlow/M02_DF_LinkPanel.ts @@ -85,6 +85,7 @@ const TEXT = { Or: ["또는", "or"], If: ["조건", "If"], AddLine: ["+ 조건 줄", "+ Condition line"], + PickOne: ["고르세요", "choose"], Join: ["잇는 말", "Join with"], OutRange: ["범위 {n} 밖", "Outside the range {n}"], Range: ["{n} (범위)", "{n} (range)"], @@ -264,12 +265,16 @@ function gateValue(ctx: Ctx, c: CfGateCond, onPick: (v: number | string) => void const list = valueChoices(ctx.lg, c.from, { values: ctx.detail.values }); if (list?.length) { const key = (v: string | number): string => `${typeof v}:${v}`; - const options = list.map((v) => ({ value: key(v), text: String(v) })); + const known = list.some((v) => key(v) === key(c.value)); + const options = [ + ...(known ? [] : [{ value: "", text: tk("PickOne") }]), + ...list.map((v) => ({ value: key(v), text: String(v) })), + ]; return [ select( ctx, options, - key(c.value), + known ? key(c.value) : "", (k) => { const hit = list.find((v) => key(v) === k); if (hit !== undefined) onPick(hit); @@ -345,8 +350,12 @@ function gateEditor(ctx: Ctx, rule: Extract): HTMLElem label: tk("AddLine"), variant: "ghost", size: "sm", - onClick: () => - put([...g.conds, { from: first?.from ?? { box: "", name: "" }, op: "=", value: 0 }]), + onClick: () => { + const from = first?.from ?? { box: "", name: "" }; + // 새 줄 기본 값 — 목록이 있는 알약이면 그 첫 값 · 아니면 0 + const value = valueChoices(ctx.lg, from, { values: ctx.detail.values })?.[0] ?? 0; + put([...g.conds, { from, op: "=", value }]); + }, }), ...(g.conds.length > 1 ? [