fix(838-3): 수식 보기 줄 쪽 표 칩 중복 걷음 · 기계 품번 글 값 = 기계 이름 · 오른쪽 「—」 없앰

- 금액 줄 수량 기호가 공식 · 표 값 묶음에 이미 보이면 줄 쪽 표 칩 안 그림(묶음에서 고름)
- 글 값 기호(기계 원문번호) = 「이름 규격 (원문번호)」 · 산출근거 글 값 = 그 글(「—」 는 값 없을 때만)
- 셈 · 금액 그대로(그림만) · 같은 꼴 M01 문서 19 개 24 식 줄

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 14:06:48 +09:00
co-authored by Claude Opus 5.5
parent 9f8e54f6eb
commit 498bfe6020
5 changed files with 32 additions and 3 deletions
+14
View File
@@ -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<string, unknown>,
+3 -1
View File
@@ -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] });
+11 -2
View File
@@ -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<string, string> = { 노무비: "노무비", 재료비: "재료비", 경비: "경 비" };
@@ -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);
+3
View File
@@ -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")
+1
View File
@@ -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") }),
);