From 0b81a6c072dac2e8ce7b1392534920232fd0d8ab Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 4 Nov 2026 20:17:12 +0900 Subject: [PATCH] =?UTF-8?q?fix(784-2):=20=EB=8B=A8=EC=9C=84=20=ED=99=98?= =?UTF-8?q?=EC=82=B0=20=EC=B9=B8=20=E2=80=94=20=EB=AA=AB=201=20=3D=20?= =?UTF-8?q?=EB=AA=AB=20=EC=97=86=EC=9D=8C=20=C2=B7=20=EC=B9=B8=20=ED=95=9C?= =?UTF-8?q?=20=EB=8D=A9=EC=9D=B4=EB=A1=9C=20=EB=AC=B6=EC=9D=8C=20=C2=B7=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=ED=99=95=EC=9D=B8=20=EB=92=A4=20=EB=8B=A4?= =?UTF-8?q?=EB=93=AC=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- .../M02_MasterTemplete_Hopyo.css | 6 +++++ .../M02_MasterTemplete_Hopyo_CheckRows.ts | 27 +++++++++---------- .../M02_MasterTemplete_Hopyo_Ledger.ts | 2 +- .../logic/M02_MasterTemplete_Hopyo_Unit.ts | 2 +- resources/tester/test_m02_hopyo_screen.py | 3 ++- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo.css b/M02_MasterTemplete/M02_MasterTemplete_Hopyo.css index 22a432272..b5ae56968 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo.css +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo.css @@ -172,6 +172,12 @@ width: 6em; } +.m02-hopyo__unit { + display: inline-flex; + align-items: center; + gap: var(--spacing-4); +} + /* 단위 환산 칸 앞뒤 글 — 「엑셀 1 ㎡ = 우리 [ ] 본」 */ .m02-hopyo__unit-text { color: var(--color-text-secondary); diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts index 7845dda03..25b8d3209 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_CheckRows.ts @@ -111,19 +111,18 @@ const stateChip = (line: HopyoLine): HTMLElement => { }; /** 단위 환산 칸 — 「엑셀 1 ㎡ = 우리 [ ] 본」(장부 화면도 같은 꼴) */ -export function unitField( - input: HTMLInputElement, - v: Pick, -): HTMLElement[] { +export function unitField(input: HTMLInputElement, v: Pick): HTMLElement { input.title = L("M02_HopyoUnitTip"); - return [ - el("span", { - className: "m02-hopyo__unit-text", - text: L("M02_HopyoUnitLead").replace("{from}", v.from || "?"), - }), - input, - ...(v.to ? [el("span", { className: "m02-hopyo__unit-text", text: v.to })] : []), - ]; + const word = (text: string): HTMLElement => + el("span", { className: "m02-hopyo__unit-text", text }); + return el("span", { + className: "m02-hopyo__unit", + children: [ + word(L("M02_HopyoUnitLead").replace("{from}", v.from || "?")), + input, + ...(v.to ? [word(v.to)] : []), + ], + }); } /** 대상마다 한 줄 — 키 · 이름 · 단위 환산(같음 = 글만 · 몫 줄 = 몫만 · 빈칸 · 추정 = 입력 칸) · 몫 */ @@ -152,9 +151,9 @@ function partLines(line: HopyoLine, parts: HopyoPart[], ctx: RowsContext): HTMLE el("span", { className: "m02-labrow__key", text: key }), el("strong", { text: p.이름 ?? "" }), ...(v.mode === "same" ? [small(L("M02_HopyoUnitSame"))] : []), - ...(v.mode === "input" ? unitField(times, v) : []), + ...(v.mode === "input" ? [unitField(times, v)] : []), ...(note ? [small(note)] : []), - ...(p.몫 != null ? [small(`몫 ${p.몫}`)] : []), + ...(p.몫 != null && p.몫 !== 1 ? [small(`몫 ${p.몫}`)] : []), ], }); }); diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Ledger.ts b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Ledger.ts index f345d4754..8392fb268 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Ledger.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Ledger.ts @@ -184,7 +184,7 @@ export function buildHopyoLedger(opt: LedgerOptions): HTMLElement { times.addEventListener("change", () => edit(r, { 짝: r.짝.map((x, i) => (i === at ? { ...x, 배: Number(times.value) } : x)) }), ); - parts.push(...unitField(times, { from: r.원래.단위, to: "" })); + parts.push(unitField(times, { from: r.원래.단위, to: "" })); if (p.로직) parts.push( createButton({ diff --git a/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Unit.ts b/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Unit.ts index 751939cb3..2284bd34e 100644 --- a/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Unit.ts +++ b/M02_MasterTemplete/logic/M02_MasterTemplete_Hopyo_Unit.ts @@ -41,7 +41,7 @@ export function unitView( ): UnitView { const f = String(from ?? "").trim(); const t = String(to ?? p.단위 ?? "").trim(); - const quota = p.몫 != null; + const quota = p.몫 != null && p.몫 !== 1; // 몫 1 = 몫 없음과 같음 const kind = p.환산?.갈래; const unitSame = kind ? kind === "같음" || kind === "두 단위" || (kind === "단위표" && p.환산?.배 === 1) diff --git a/resources/tester/test_m02_hopyo_screen.py b/resources/tester/test_m02_hopyo_screen.py index cd629bc87..817210cd4 100644 --- a/resources/tester/test_m02_hopyo_screen.py +++ b/resources/tester/test_m02_hopyo_screen.py @@ -604,10 +604,11 @@ def test_단위_환산_칸_보이기_784_2(): {"part": {"배": 0.01, "몫": 0.1, "환산": {"배": 0.1, "갈래": "단위표"}}, "from": "a", "to": "b"}, {"part": {"배": 1}, "from": "m2", "to": "㎡"}, {"part": {"배": 1}, "from": "m", "to": "본"}, + {"part": {"배": 1, "몫": 1, "환산": {"배": 1, "갈래": "같음"}}, "from": "㎡", "to": "㎡"}, ] # fmt: skip got = _node("helper_m02_hopyo_unit.cjs", {"cases": cases}) assert [g["mode"] for g in got] == [ - "same", "same", "quota", "input", "input", "input", "input", "input", "same", "input", + "same", "same", "quota", "input", "input", "input", "input", "input", "same", "input", "same", ] # fmt: skip assert (got[3]["from"], got[3]["to"]) == ("㎡", "본") # 「엑셀 1 ㎡ = 우리 [ ] 본」 assert got[5]["estimated"] and got[5]["thick"] == 0.2 # 「두께 0.2m 로 추정」