From bb4450d729518f9d52d7b3fdfb4e8def6c79a77c Mon Sep 17 00:00:00 2001 From: umsangdon Date: Fri, 9 Oct 2026 19:00:20 +0900 Subject: [PATCH] =?UTF-8?q?feat(M02):=20=EB=8B=A8=EA=B0=80=EC=82=B0?= =?UTF-8?q?=EC=B6=9C=20=EC=9E=90=EC=9E=AC=20=EC=A4=84=20=EB=88=84=EB=A6=84?= =?UTF-8?q?=20=3D=20=EA=B7=B8=20=EB=A1=9C=EC=A7=81=20[=EC=98=B5=EC=85=98]?= =?UTF-8?q?=20=EB=AA=A8=EB=8B=AC=20=C2=B7=20=EC=9D=BD=EA=B8=B0=20=EC=A0=84?= =?UTF-8?q?=EC=9A=A9=EC=9D=80=20=EB=B3=B4=EA=B8=B0=EB=A7=8C(148-1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015sDZSjFvoiDjdGpgj3muc3 --- .../M02_MasterTemplete_Labor_Detail.ts | 2 +- .../M02_MasterTemplete_Labor_LogicMats.ts | 25 ++++++++++++------- resources/tester/test_m02_labor_logic_mats.py | 16 ++++++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/M02_MasterTemplete/M02_MasterTemplete_Labor_Detail.ts b/M02_MasterTemplete/M02_MasterTemplete_Labor_Detail.ts index 33ba90be7..70f5bb5f6 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Labor_Detail.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Labor_Detail.ts @@ -228,7 +228,7 @@ export function mountLaborDetail( cur.담은로직, calc ?? last, !calc && !fail, - edit ? { swap: swapMat, reset: resetMat } : undefined, + edit ? { open: openRow, swap: swapMat, reset: resetMat } : { open: openRow }, ), }, edit ? { open: openMat, remove: removeMat } : { open: openMat }, diff --git a/M02_MasterTemplete/M02_MasterTemplete_Labor_LogicMats.ts b/M02_MasterTemplete/M02_MasterTemplete_Labor_LogicMats.ts index 90cea47f5..924640cac 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Labor_LogicMats.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Labor_LogicMats.ts @@ -5,6 +5,7 @@ * · 삭제 없음 · [바꾸기] = M01 자재품목 표에서 고름(문서 `담은로직[].고름` · 엔진 `choosing`) · 바꾼 줄만 [기본](고름 풂) * · 금액은 로직 단가 안이라 합에 다시 안 더함(보기만) · 수량은 로직 것(누름 · 알약 없음) * · 하위 로직 안 재료는 안 보임(엔진이 맨 위 층만 고름) + * · 줄 누름(148-1) = 그 로직 줄 [옵션] 모달(읽기만이면 보기) · [바꾸기] · [기본]은 고칠 때만 * ========================================================================== */ import { createButton, el } from "@ui/ui_template_elements"; @@ -18,10 +19,12 @@ import { tc } from "./M02_MasterTemplete_Labor_Text"; import type { LogicMat } from "./M02_Labor_LogicMats_Model"; export interface LogicMatHandlers { - /** [바꾸기]로 고른 품목 키 — `row` = 담은 로직 차례 · `at` = 호표 차례 */ - swap: (row: number, at: number, key: string) => void; + /** 줄 누름(148-1) = 그 자재를 낸 로직 줄 [옵션] 모달 — `row` = 담은 로직 차례 */ + open: (row: number) => void; + /** [바꾸기]로 고른 품목 키 — `row` = 담은 로직 차례 · `at` = 호표 차례 · 없으면(읽기만) 단추 칸 없음 */ + swap?: (row: number, at: number, key: string) => void; /** [기본] — 그 줄 고름 풂 */ - reset: (row: number, at: number) => void; + reset?: (row: number, at: number) => void; } const num = (v: number | null): string => @@ -63,7 +66,9 @@ function matRow( }; const money = moneyCell(mat.단가, mat.금액, wait, tc("Labor_AppliedSum")); money.title = tc("LogicMat_Inside"); - const tools = on + const swap = on?.swap; + const reset = on?.reset; + const tools = swap ? [ el("td", { className: "m02-labrow__move", @@ -82,18 +87,18 @@ function matRow( seed: headWord(name), alt: [headWord(mat.이름)], isCurrent: (x) => String(x["키"]) === item?.키, - onPick: (x) => on.swap(r, mat.차례, String(x["키"])), + onPick: (x) => swap(r, mat.차례, String(x["키"])), }); }, }), - ...(mat.고름 + ...(mat.고름 && reset ? [ createButton({ label: tc("LogicMat_Reset"), variant: "ghost", onClick: (e) => { e.stopPropagation(); - on.reset(r, mat.차례); + reset(r, mat.차례); }, }), ] @@ -104,8 +109,8 @@ function matRow( }), ] : []; - return el("tr", { - className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}`, + const tr = el("tr", { + className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}${on ? " is-open" : ""}`, attrs: { "data-labor-logic-mat": `${row.로직}|${mat.차례}` }, children: [ el("td", { className: "m02-labrow__code", text: item?.키 ?? "—" }), @@ -141,4 +146,6 @@ function matRow( ...tools, ], }); + if (on) tr.addEventListener("click", () => on.open(r)); + return tr; } diff --git a/resources/tester/test_m02_labor_logic_mats.py b/resources/tester/test_m02_labor_logic_mats.py index e2c39830e..293b2ee7e 100644 --- a/resources/tester/test_m02_labor_logic_mats.py +++ b/resources/tester/test_m02_labor_logic_mats.py @@ -160,3 +160,19 @@ def test_입력이_바뀌면_걸린_고름만_풂_화면_짝(): assert _release(row, {"규격": "BX"}, mats)["고름"] == {"9": WIRE} # 규격에 걸린 줄만 row = {**row, "고름": {"4": "MT007895"}} assert "고름" not in _release(row, {}, mats) # 다 풀리면 칸째 지움 + + +def _src(name): + with open(os.path.join(HERE, "..", "..", "M02_MasterTemplete", name), encoding="utf-8") as f: + return f.read() + + +def test_로직_자재_줄_누름은_그_로직_옵션_모달_사용자_줄은_그대로(): + """148-1 — 고칠 때 · 읽기만 둘 다 `open: openRow` · 바꾸기 단추 칸은 swap 있을 때만 · 사용자 줄 = openMat.""" + detail = _src("M02_MasterTemplete_Labor_Detail.ts") + assert "edit ? { open: openRow, swap: swapMat, reset: resetMat } : { open: openRow }" in detail + assert "edit ? { open: openMat, remove: removeMat } : { open: openMat }" in detail + mats = _src("M02_MasterTemplete_Labor_LogicMats.ts") + assert "const tools = swap" in mats + assert 'tr.addEventListener("click", () => on.open(r))' in mats + assert '${on ? " is-open" : ""}' in mats