feat(714-2): 공용 단가산출 계산서 틀 — A00_Common/calc_sheet.ts(704-2 계산서 줄 올림 · 묶음 머리 변수 칸 · 바꾸면 onInput) · M02 계산서 보기 · M01 「인력·재료·경비」 보기가 한 벌로 씀(장비 한 줄 · 기준단위 · 환산 근거는 714-1 뒤)

- 704-2 Labor_Sheet 줄 · 소계 · 계 = calcSheetRows(표본 셋 DOM 전후 같음)
- 새 M01_MasterData_UI_LogicLab_Est.ts — /text 묶음 그대로 · 묶음이 쓰는 시험 입력(714-3 usedInputs) = 머리 변수 칸 · 「준비 중」 자리 걷음
- 낡은 시험 test_704_logic_standard 고침 — 계산서가 계산 줄 부품을 공용 계산서 안에서 씀(import 자리만 바뀜)
- 새 지킴 시험 test_714_2_calc_sheet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 16:03:36 +09:00
co-authored by Claude Opus 5.5
parent 915feb436e
commit cddb28b63a
8 changed files with 224 additions and 27 deletions
@@ -24,6 +24,7 @@ import { openPicker } from "./M01_MasterData_UI_Logic_Pick";
import { safeReason, tx } from "./M01_MasterData_UI_Logic_Text";
import { pickMaterial } from "./M01_MasterData_UI_Logic_CalcPick";
import { buildFormula } from "./M01_MasterData_UI_LogicLab_Formula";
import { buildEst } from "./M01_MasterData_UI_LogicLab_Est";
import {
condText,
openMaterialModal,
@@ -38,7 +39,6 @@ import { tl, type LabTextKey } from "./M01_MasterData_UI_LogicLab_Text";
import "./M01_MasterData_UI_LogicLab_Style.css";
import "./M01_MasterData_UI_LogicLab_Pill.css";
import { createBadge } from "@ui/ui_template_badge";
import { createEmpty } from "@ui/ui_template_empty";
import { block, nowInputs } from "./M01_MasterData_UI_LogicLab_View";
/** 서버 조각(`/text` 줄의 `조각`) → 수량 칸 조각 — 요소·표·로직은 알약(글 = 조각 글) · 나머지는 글자 */
@@ -525,7 +525,10 @@ export function buildLabDetail(host: HTMLElement, ctx: DetailContext): void {
host.replaceChildren(
...infoBox(ctx),
block(section(tl("Calc_Title"), [ctx.calcHost]), "calc"),
block(section(tl("View_Est"), [createEmpty({ text: tl("View_Soon"), small: true })]), "est"),
block(
section(tl("View_Est"), [buildEst({ text: ctx.text, unit: ctx.row.결과단위, ...fx })]),
"est",
),
...(ctx.flowHost
? [block(nowInputs(ctx.values), "ho"), ctx.flowHost]
: [hoBox(ctx), block(section(tl("Formula_Title"), [formula]), "formula")]),
@@ -0,0 +1,49 @@
/* =============================================================================
* M01_MasterData_UI_LogicLab_Est.ts
* 「인력·재료·경비」 보기(PLAN 714-2) — 공용 단가산출 계산서(`A00_Common/calc_sheet.ts`)에 시험 계산 읽는 식(`/text`)을 그대로.
* 묶음 머리 변수 칸 = 그 묶음 줄들이 쓰는 시험 입력(714-3 `usedInputs`) · 바꾸면 시험 계산 입력 고침 + 다시 셈(정본 안 바뀜)
* ========================================================================== */
import { el } from "@ui/ui_template_elements";
import { createText } from "@ui/ui_template_text";
import { calcSheetRows } from "../A00_Common/calc_sheet";
import type { LogicInput } from "./M01_MasterData_UI_Logic_Api";
import { safeReason } from "./M01_MasterData_UI_Logic_Text";
import { usedInputs, type PreviewTextAnswer } from "./M01_MasterData_UI_LogicLab_Formula";
import { tl } from "./M01_MasterData_UI_LogicLab_Text";
export interface EstContext {
text: PreviewTextAnswer | null;
unit: string;
inputs: LogicInput[];
values: Record<string, string>;
onInput?: (name: string, value: string) => void;
}
export function buildEst(ctx: EstContext): HTMLElement {
const host = el("div", { className: "m01lab-est", attrs: { "data-est": "" } });
const text = ctx.text;
if (!text || (text.ok && text.계산됨 === false)) {
host.append(createText(tl("Formula_Slot"), "muted"));
return host;
}
if (!text.ok) {
host.append(createText(safeReason(text.reason), "error"));
return host;
}
const names = ctx.inputs.map((x) => x.이름);
host.append(
...calcSheetRows({
묶음: text.groups,
계: text.계,
sumLabel: `${tl("Total")} (${ctx.unit || "원"})`,
inputs: ctx.inputs,
values: ctx.values,
onInput: ctx.onInput,
uses: (_, gi) => [
...new Set(text.groups[gi].줄.flatMap((line) => usedInputs(line, names).map(([n]) => n))),
],
}),
);
return host;
}
@@ -225,3 +225,11 @@
max-height: 40vh;
overflow: auto;
}
/* 714-2 「인력·재료·경비」 — 공용 계산서 줄을 세로로 */
.m01lab-est {
display: flex;
flex-direction: column;
gap: var(--spacing-4);
min-width: 0;
}
@@ -30,10 +30,6 @@ const TEXT = {
Calc_Title: ["시험 계산", "Trial calculation"],
View_Est: ["인력·재료·경비", "Labor·material·expense"],
View_Label: ["보기", "View"],
View_Soon: [
"준비 중 — 인력 · 재료 · 경비 묶음 보기",
"Coming soon — labor · material · expense view",
],
Now_Inputs: ["지금 입력", "Current inputs"],
Now_None: ["없음", "none"],
G_labor: ["인력", "Labor"],