feat(796-2a): 수식 탭 화면 — 공통 수식 부품 · M01 수식 탭(첫 탭) · 고침 · 변수 창 · 옵션 가로

- ui_template_equation(.ts · _line.ts · .css): 분수 · 첨자 · 괄호 · % · 조건 칩 · 하위 로직 블록(접힘) · 결과명 = 이름 식 = 값 식 = 결과 + 변수 풀이 · 부품 모음 견본 한 줄
- M01 LogicLab_Equation: 옵션 가로(도구줄 + 값 칸 · 찾기형 · 말줄임) · 줄 고르면 식 칸 + 숨은 아이콘 줄 · 서버 미리 셈 다시 그림 · 고침 목록 캐시 → [수식 저장](개정 확인) · 떠나기 전 버림 물음
- 변수 창(이름 · 기호 · 위 · 아래첨자 · 단위 · 값 · 보이는 자리) · 변수 더함 · 지움(쓰는 곳 있으면 서버 까닭 그대로)
- 보기 고르기 = 수식 첫 탭 · 단가산출 상세 · 시트 · 인력재료경비 · 시험계산 · 텍스트 수식은 뒤로(걷지 않음)
- test_796_2_equation_screen 새로 · test_794_1 기대 갱신(첫 탭 수식 · LogicLab 700 줄 상한 — 수식 이음 14 줄)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 11:46:28 +09:00
co-authored by Claude Sonnet 5.5
parent 771e89c983
commit eaadb48a2b
15 changed files with 1973 additions and 12 deletions
+18 -2
View File
@@ -43,6 +43,7 @@ import { saveRevised } from "./M01_MasterData_UI_LogicLab_Revise";
import { buildLogicSide } from "./M01_MasterData_UI_LogicLab_Side";
import { createViewPicker } from "./M01_MasterData_UI_LogicLab_View";
import { createLabSheet } from "./M01_MasterData_UI_LogicLab_Sheet";
import { createLabEquation } from "./M01_MasterData_UI_LogicLab_Equation";
import { buildHeadBar } from "./M01_MasterData_UI_Head";
import { fetchSessionUser } from "../A06_Login/A06_Login_Api_Fetch";
import "./M01_MasterData_UI_Logic_Style.css";
@@ -111,6 +112,14 @@ export async function mountM01LogicLab(
edited: () => (touch(), drawEditor(), drawCalc()), // 줄 사본 → 캐시 → [저장](기존 길)
run: () => calc.querySelector<HTMLButtonElement>("[data-calc-run]")?.click(),
});
const equation = createLabEquation({
admin,
blocked: () => !!opened && opened.id in drafts, // 시트 · 시험 쪽 저장 안 한 고침이 있으면 수식 고침 잠김
onSaved: () => {
const was = opened; // reload 가 고름을 비우므로 먼저 기억
if (was?.row?.키) void reload().then(() => open(was.id, was.sub, was.row!.키));
},
});
const editor = el("div", { className: "m01-logic__editor" });
// 로직 상세 — 왼쪽 지금 내용 · 오른쪽 접는 패널 「원문」
const panes = buildLogicSide(editor);
@@ -128,7 +137,11 @@ export async function mountM01LogicLab(
(item) => void open(item.id, item.sub, item.key),
(item, alias) => void onAlias(item, alias),
);
const back = createButton({ label: tx("Bar_Back"), variant: "ghost", onClick: () => show(null) });
const back = createButton({
label: tx("Bar_Back"),
variant: "ghost",
onClick: () => void equation.canLeave().then((ok) => ok && show(null)),
});
const persist = (): void => {
try {
@@ -243,7 +256,9 @@ export async function mountM01LogicLab(
calcHost: calc,
admin,
sheet: sheet.root,
equation: equation.root,
});
if (current.origKey) equation.draw(current.origKey, current.version, current.row as LogicRow);
sheet.draw(current.row as LogicRow, current.original, current.values);
};
@@ -321,7 +336,7 @@ export async function mountM01LogicLab(
restore: true,
onPick: (sub, detail) => {
list.setPick(sub, detail);
if (opened) show(null);
if (opened) void equation.canLeave().then((ok) => ok && show(null));
},
}),
);
@@ -502,6 +517,7 @@ export async function mountM01LogicLab(
show(null);
showLoadingOverlay();
const openKeyOn = async (key: string): Promise<void> => {
if (!(await equation.canLeave())) return;
const found = allLogics.find((x) => x.키 === key);
if (found) await open(logicId(found.구분, found.키), found.구분, found.키);
else showToast(tx("Load_Failed"), "error");