feat(M02): 51-14 일위대가 순서 칸 2행 — 위 [위로] [아래로] / 아래 [옵션]·[수정] [삭제] · 단가승격 [옵션] · 일위조합 [수정] 서고 원본 모달

- 순서 칸 = 단추 묶음 두 줄(공용 ui-btn-group 간격) · 카드 갈래는 아래 줄만
- 단가승격 줄 [옵션] = 승격 문서 넣을 값 모달 · [저장] = 서고 저장 길 · 머리 한 줄 알림(쓰는 모든 구조물에 따라감)
- 일위조합 줄 [수정] = 사전조합 상세 모달(서고 모드 표 · 옵션 · 수량 · 순서 · 삭제 · 추가) · [저장] = 서고 원본 · 취소 = 버림 물음
- 자기 층 서고만 고침(위 층 = 읽기만) · 닫으면 구조물 일위대가 다시 셈
- 확인 시나리오 resources/tester/ui_checks/51-14_순서칸_2행_옵션수정.js

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
This commit is contained in:
2026-10-05 21:05:31 +09:00
co-authored by Claude Opus 5.5
parent a8045bbacc
commit 47cbbd17bd
8 changed files with 403 additions and 14 deletions
+21 -2
View File
@@ -86,7 +86,9 @@ def test_일위대가_카드는_상세_카드_갈래():
assert "...(opt.card || lib ? [] : [dgBox])," in detail
assert "opt.card ? null : addMat" in detail # 49-6 — 카드엔 [자재 추가] 없음 · 상세는 그대로
rows = _text("M02_MasterTemplete_Labor_Rows.ts")
assert "const tools = !!(move || remove || option);" in rows and "compactTable" not in rows
assert (
"const tools = !!(move || remove || option || ref);" in rows and "compactTable" not in rows
)
assert "compact" not in _text("M02_MasterTemplete_Labor_View.ts").split("*/", 1)[1]
@@ -127,7 +129,9 @@ def test_일위대가_줄_고름과_옵션_단추():
단추 위로 · 아래로 · 옵션 · 삭제(빨강) · 묶음 간격 = 공용 `ui-btn-group`."""
detail = _text("M02_MasterTemplete_Labor_Detail.ts")
assert "open: pick," in detail and "option: openRow," in detail
assert "{ open: pick, option: openRow }" in detail # 읽기만도 고름 · [옵션] = 보기 모달
assert (
"{ open: pick, option: openRow, ref: openRef }" in detail
) # 읽기만도 고름 · [옵션] = 보기 모달
assert "selected: picked" in detail
rows = _text("M02_MasterTemplete_Labor_Rows.ts")
up, down = rows.index('small(tc("Up")'), rows.index('small(tc("Down")')
@@ -141,3 +145,18 @@ def test_일위대가_줄_고름과_옵션_단추():
assert t in text
css = (ROOT / "ui_template" / "ui_template_general_layout.css").read_text(encoding="utf-8")
assert ".ui-btn-group {" in css and "gap: var(--btn-group-gap);" in css
def test_순서칸_2행_참조줄_옵션_수정():
"""51-14 — 순서 칸 2행(위 [위로] [아래로] / 아래 [옵션]·[수정] [삭제]) · 단가승격 [옵션] · 일위조합 [수정] =
서고 원본 모달(저장 = 서고 저장 길 · 자기 층만 고침) · 닫으면 다시 셈."""
rows = _text("M02_MasterTemplete_Labor_Rows.ts")
assert 'className: "m02-labrow__tools"' in rows
assert '"SP-") ? "Labor_Option" : "Labor_Edit"' in rows
detail = _text("M02_MasterTemplete_Labor_Detail.ts")
assert "readOnly: !edit || ref.층 !== opt.layer," in detail
assert "closed: () => alive && recalc()," in detail
ref = _text("M02_MasterTemplete_Labor_RefEdit.ts")
assert "saveTemplate(layer, kind, opt.ref.키, null, 판, body)" in ref
assert 'mode: "precombo",' in ref and "showConfirmDialog" in ref
assert 'Labor_Edit: ["수정"' in _text("M02_MasterTemplete_Labor_Text.ts")
@@ -0,0 +1,159 @@
/* 51-14 — 일위대가 표 순서 칸 2행(위 [위로] [아래로] / 아래 [옵션]·[수정] [삭제]) · 단가승격 [옵션] · 일위조합 [수정] 모달
* 시작 화면: M02 마스터 템플릿 · 마스터 층(#/m02-master-template?open=구조물조합&root=master) · 시스템 관리자 ·
* 나무에 item3(단가승격 SP-000001 · 일위조합 SC-000001 줄이 있음)
* 부르는 법: orca eval --expression "$(cat 이 파일)" (async 식 · JSON 글을 돌려줌)
* 쓰기 없음 — 모달은 모두 [취소]로 닫음 · PUT 수 = 0 확인(서고 저장 안 함)
* 기대 수치:
* - card.sp / card.sc: groups 1 · labels [옵션, 삭제] / [수정, 삭제]
* - detail.sp / detail.sc: groups 2 · top [위로, 아래로] · bottom [옵션, 삭제] / [수정, 삭제] · danger = 삭제
* - promote: notice 있음 · foot [취소, 저장] · closed = true
* - combo: notice 있음 · add [로직 추가] · foot [취소, 저장] — 모달 안 [로직 추가]로 단가산출 한 줄 넣음(화면만) ·
* added.groups 2 · top [위로, 아래로] · bottom [옵션, 삭제] · [취소] = 버림 물음(asked) → 확인 · closed = true · recalc ≥ 1
* - puts = 0
*/
(async () => {
const w = (ms) => new Promise((r) => setTimeout(r, ms));
const until = async (fn, ms = 8000) => {
for (let t = 0; t < ms; t += 150) {
const v = fn();
if (v) return v;
await w(150);
}
return null;
};
const SC = "참조|system||SC-000001";
const SP = "참조|system||SP-000001";
const real = window.fetch;
let puts = 0;
let calcs = 0;
window.fetch = (input, init) => {
const url = typeof input === "string" ? input : input.url;
if ((init?.method ?? "GET").toUpperCase() === "PUT") puts++;
if (/\/labor\/item3\/calc/.test(url)) calcs++;
return real(input, init);
};
const txt = (b) => b.innerText.trim();
const tools = (tb, key) => {
const cell = tb.querySelector(`tr[data-labor-logic="${key}"] .m02-labrow__move`);
const groups = [...cell.querySelectorAll(".m02-labrow__tools > .ui-btn-group")];
const btn = (g) => [...g.querySelectorAll("button")];
const last = groups.at(-1) ? btn(groups.at(-1)).at(-1) : null;
return {
groups: groups.length,
top: groups.length > 1 ? btn(groups[0]).map(txt) : [],
bottom: groups.length ? btn(groups.at(-1)).map(txt) : [],
danger: last ? last.className : "",
_btn: (label) => groups.flatMap(btn).find((b) => txt(b) === label),
};
};
const clean = (t) => {
delete t._btn;
return t;
};
const modal = () => [...document.querySelectorAll(".ui-modal")].at(-1) ?? null;
const foot = (m) => [...m.querySelectorAll(".m02-labin__foot button")].map(txt);
const cancel = async (m) => {
[...m.querySelectorAll(".m02-labin__foot button")].find((b) => txt(b) === "취소").click();
await w(600);
return !document.body.contains(m);
};
try {
const node = await until(() => document.querySelector('[data-node="i|item3"]'));
if (!node) return JSON.stringify({ error: "item3 없음 — 폴더를 펼쳐 둘 것" });
document.querySelector('[data-node="i|item1"]')?.click(); // 다시 읽게 다른 항목 거침
await w(1500);
node.click();
const card = await until(() =>
[...document.querySelectorAll(".m02-struct__card")].find((c) =>
c.querySelector(`table.m02-labrow tbody tr[data-labor-logic="${SC}"]`),
),
);
if (!card) return JSON.stringify({ error: "일위조합 줄 카드 없음" });
await w(1500);
const ct = card.querySelector("table.m02-labrow");
const out = { card: { sp: clean(tools(ct, SP)), sc: clean(tools(ct, SC)) } };
const edit = [...card.querySelectorAll(".m02-struct__card-tools button")].find(
(b) => txt(b) === "수정",
);
if (!edit) return JSON.stringify({ ...out, error: "일위대가 [수정] 없음" });
edit.click();
const detail = () =>
[...document.querySelectorAll("table.m02-labrow")].find(
(t) =>
!t.closest(".m02-struct__card, .ui-modal") &&
t.querySelector(`tr[data-labor-logic="${SC}"]`),
);
if (!(await until(detail))) return JSON.stringify({ ...out, error: "상세 표 없음" });
await w(2000);
const sp = tools(detail(), SP);
const sc = tools(detail(), SC);
out.detail = { sp: clean({ ...sp }), sc: clean({ ...sc }) };
// 단가승격 [옵션] — 넣을 값 모달 · 알림 한 줄 · [취소]
sp._btn("옵션").click();
const pm = await until(() => modal()?.querySelector(".m02-inputval") && modal());
out.promote = pm
? {
title: pm.querySelector(".ui-modal__top h3").innerText,
notice: !!pm.querySelector("[data-labor-notice]"),
inputs: pm.querySelectorAll("[data-labor-input]").length,
foot: foot(pm),
closed: await cancel(pm),
}
: { error: "승격 모달 없음" };
// 일위조합 [수정] — 사전조합 상세 모달 · [취소] · 닫으면 다시 셈
tools(detail(), SC)._btn("수정").click();
const cm = await until(() => document.querySelector(".m02-labref"));
if (!cm) return JSON.stringify({ ...out, error: "일위조합 모달 없음", puts });
await w(1000);
out.combo = {
title: cm.querySelector(".ui-modal__top h3").innerText,
notice: !!cm.querySelector("[data-labor-notice]"),
rows0: cm.querySelectorAll("table.m02-labrow tbody tr[data-labor-logic]").length,
add: [...cm.querySelectorAll(".m01-logic__section-head button")].map(txt),
foot: foot(cm),
};
// 모달 안 [로직 추가] → 단가산출 첫 줄(화면 캐시만)
[...cm.querySelectorAll(".m01-logic__section-head button")]
.find((b) => txt(b) === "로직 추가")
.click();
const pick = await until(
() =>
[...document.querySelectorAll(".m01-logic__pick .ui-find__row")].find(
(r) => r.querySelector(".ui-find__tag")?.innerText.trim() === "단가산출",
),
30000, // 로직 목록 1천여 줄
);
if (!pick) return JSON.stringify({ ...out, error: "고르기 줄 없음", puts });
pick.click();
const added = await until(() =>
cm.querySelector("table.m02-labrow tbody tr[data-labor-logic]"),
);
if (added) {
const key = added.getAttribute("data-labor-logic");
out.combo.added = clean(tools(cm.querySelector("table.m02-labrow"), key));
}
const before = calcs;
[...cm.querySelectorAll(".m02-labin__foot button")].find((b) => txt(b) === "취소").click();
const ask = await until(() => document.querySelector(".ui-confirm"));
out.combo.asked = !!ask;
[...(ask?.querySelectorAll("button") ?? [])].find((b) => txt(b) === "확인")?.click();
await w(600);
out.combo.closed = !document.body.contains(cm);
await w(1200);
out.combo.recalc = calcs - before;
out.puts = puts;
document.querySelector('[data-node="i|item3"]')?.click();
await w(800);
[...document.querySelectorAll(".ui-modal button, dialog button")]
.find((b) => /확인|버림|떠나기/.test(b.innerText))
?.click();
await w(1200);
out.back = !!document.querySelector(".m02-struct__card table.m02-labrow");
return JSON.stringify(out);
} finally {
window.fetch = real;
}
})();