From 498bfe6020fd14ec880c93c28769abf7833590a5 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sun, 15 Nov 2026 14:06:48 +0900 Subject: [PATCH] =?UTF-8?q?fix(838-3):=20=EC=88=98=EC=8B=9D=20=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=EC=A4=84=20=EC=AA=BD=20=ED=91=9C=20=EC=B9=A9=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EA=B1=B7=EC=9D=8C=20=C2=B7=20=EA=B8=B0?= =?UTF-8?q?=EA=B3=84=20=ED=92=88=EB=B2=88=20=EA=B8=80=20=EA=B0=92=20=3D=20?= =?UTF-8?q?=EA=B8=B0=EA=B3=84=20=EC=9D=B4=EB=A6=84=20=C2=B7=20=EC=98=A4?= =?UTF-8?q?=EB=A5=B8=EC=AA=BD=20=E3=80=8C=E2=80=94=E3=80=8D=20=EC=97=86?= =?UTF-8?q?=EC=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 금액 줄 수량 기호가 공식 · 표 값 묶음에 이미 보이면 줄 쪽 표 칩 안 그림(묶음에서 고름) - 글 값 기호(기계 원문번호) = 「이름 규격 (원문번호)」 · 산출근거 글 값 = 그 글(「—」 는 값 없을 때만) - 셈 · 금액 그대로(그림만) · 같은 꼴 M01 문서 19 개 24 식 줄 Co-Authored-By: Claude Opus 5.5 --- A00_Common/formula_doc_options.ts | 14 ++++++++++++++ A00_Common/line_stack_edit.ts | 4 +++- A00_Common/line_stack_out.ts | 13 +++++++++++-- A00_Common/line_stack_rows.ts | 3 +++ A00_Common/line_stack_screen.ts | 1 + 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/A00_Common/formula_doc_options.ts b/A00_Common/formula_doc_options.ts index 129dfd2c1..6a33a6095 100644 --- a/A00_Common/formula_doc_options.ts +++ b/A00_Common/formula_doc_options.ts @@ -29,6 +29,20 @@ export function nameMachines(list: string[], redraw: () => void): void { }); } +let asked = false; +/** 글 값이 기계 원문번호면 「이름 규격 (원문번호)」(838-3 · 요구 859) — 이름이 아직 없으면 한 번 받아 `redraw` · 아니면 null */ +export function machineText(x: unknown, redraw: () => void): string | null { + if (typeof x !== "string" || !MACHINE.test(x)) return null; + if (!(x in names) && !asked) { + asked = true; + void cfMachineNames().then((got) => { + names = { ...names, ...got }; + redraw(); + }); + } + return optionText(x); +} + export function buildOptions( doc: FormulaDoc | null, given: Record, diff --git a/A00_Common/line_stack_edit.ts b/A00_Common/line_stack_edit.ts index f19048374..78d7a15d4 100644 --- a/A00_Common/line_stack_edit.ts +++ b/A00_Common/line_stack_edit.ts @@ -320,7 +320,9 @@ function qtyBox( ); f.dataset.qty = String(i); const val = v ? (h.answer.값 ?? {})[text] : undefined; - const tag = v ? sourceTag(h, text, v.연결) : null; + // 838-3 공식 · 표 값 묶음에 이미 보이는 기호 = 줄 쪽 표 칩 걷음(묶음에서 고름) · 묶음에 없으면 줄에서 고름 + const inBlock = h.items.some((it) => it.줄.some((l) => l.꼴 === "공식" && l.기호.includes(text))); + const tag = v && !inBlock ? sourceTag(h, text, v.연결) : null; if (tag && isNum(val)) tag.title = `${eqText(val)}${shownUnit(v?.단위) ? ` ${shownUnit(v?.단위)}` : ""} — ${tag.title || tag.textContent}`; return el("span", { className: "lstk-qty", children: tag ? [f, tag] : [f] }); diff --git a/A00_Common/line_stack_out.ts b/A00_Common/line_stack_out.ts index 8b20d646e..e1b0642b7 100644 --- a/A00_Common/line_stack_out.ts +++ b/A00_Common/line_stack_out.ts @@ -22,6 +22,7 @@ import { offLine, type Values, } from "../common_util/common_util_formula_doc_view"; +import { machineText } from "./formula_doc_options"; import { reach } from "./formula_doc_render"; import { kindOf, @@ -59,6 +60,8 @@ export interface OutHooks { miss: () => void; /** 836-1 기계 덮음(맨 위 문서 칸) — 펼친 기계 식에 얹음(계산기와 같음) */ cover?: Cover; + /** 838-3 기계 이름을 받은 뒤 다시 그림 */ + redraw?: () => void; } const COST_SHOW: Record = { 노무비: "노무비", 재료비: "재료비", 경비: "경 비" }; @@ -180,7 +183,9 @@ function rows( flush(); const res = isNum(v) ? katexNode(`${valTex(v)}\\ ${unit(id) ? `\\text{${unit(id)}}` : ""}`) - : missing(a, id); + : typeof v === "string" // 글 값(기계 원문번호 등 · 838-3) = 그 글 · 기계면 이름 + ? el("span", { text: machineText(v, () => h.redraw?.()) ?? v }) + : missing(a, id); // 기호식 = 값식 = 결과 — 같은 꼴이 이어지면 한 번만(만약이 수 하나를 탄 줄) const n = nodeOf(t)!; const sym = tex(n, { side: "sym", vals, alias }); @@ -222,7 +227,11 @@ function rows( head, ...expr, " = ", - isNum(v) ? `${eqText(v)} ${unit(id)}` : typeof v === "string" ? v : missing(a, id), + isNum(v) + ? `${eqText(v)} ${unit(id)}` + : typeof v === "string" + ? (machineText(v, () => h.redraw?.()) ?? v) + : missing(a, id), ], }); pack.push(cell); diff --git a/A00_Common/line_stack_rows.ts b/A00_Common/line_stack_rows.ts index 061f8d62b..3011151b8 100644 --- a/A00_Common/line_stack_rows.ts +++ b/A00_Common/line_stack_rows.ts @@ -24,6 +24,7 @@ import { } from "../common_util/common_util_formula_doc"; import { isNum } from "../common_util/common_util_formula_doc_calc"; import { decide, hasIf, tryParse } from "../common_util/common_util_formula_doc_view"; +import { machineText } from "./formula_doc_options"; import { dropSyms, freshId, @@ -157,6 +158,8 @@ export function buildBlock( const realText = (t: string): string => aliasText(t, alias, true); const valText = (id: string): string => { const v = vals[id]; + const mach = machineText(v, () => h.change(() => undefined)); // 838-3 기계 원문번호 = 이름 + if (mach) return mach; if (isNum(v) || typeof v === "string") return `${eqText(v)} ${shownUnit(vars.get(id)?.단위)}`.trim(); if (v && typeof v === "object") diff --git a/A00_Common/line_stack_screen.ts b/A00_Common/line_stack_screen.ts index e362764a3..c34a30e8c 100644 --- a/A00_Common/line_stack_screen.ts +++ b/A00_Common/line_stack_screen.ts @@ -381,6 +381,7 @@ export function createStackScreen(opt: StackScreenOptions) { }, miss: ask, pair: (loc) => pair(loc, "right"), + redraw: () => draw(), }) : el("p", { className: "ui-text ui-text--muted", text: lt("Empty") }), );