feat(M01): 새로 만들기 모달에 새 길 잇기 — 절 목록으로 원문 절 고르기 · 절로 표 거르기 · 표 조건 값 목록 · 초안 시험 계산 · 자체 로직 저장(GX) · 본떠 만들기

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
This commit is contained in:
2026-09-21 09:43:19 +09:00
co-authored by Claude Sonnet 5
parent 63832239d4
commit beea3fac46
11 changed files with 383 additions and 202 deletions
@@ -5,7 +5,7 @@
* ========================================================================== */
import type { HoLine, LogicInput, LogicRow, NamedFormula } from "./M01_MasterData_UI_Logic_Api";
import type { TableBrief, TableFull } from "./M01_MasterData_UI_Logic_Wizard_Api";
import type { TableBrief, TableInfo } from "./M01_MasterData_UI_Logic_Wizard_Api";
export type Bind = { ask: true } | { ask: false; value: string };
export type Atom =
@@ -82,7 +82,7 @@ export const COST_OF: Record<LineKind, string> = {
};
/** 표 통째 — 고르기 목록·조건 종류를 셈할 때 씀(모달이 읽어 두는 곳) */
export const tableInfo = new Map<string, TableFull>();
export const tableInfo = new Map<string, TableInfo>();
export const emptyAtom = (): Atom => ({ kind: "value", value: "" });
export const emptyQty = (): Qty => ({ atom: emptyAtom(), times: "" });
@@ -153,8 +153,7 @@ export const qtyPlain = (q: Qty): string =>
export function condChoices(table: string, cond: string): (string | number)[] | undefined {
const info = tableInfo.get(table);
if (!info || info.?.[cond] !== "고르기") return undefined;
const seen = (info. ?? []).map((r) => r[cond] as string | number | undefined | null);
return [...new Set(seen.filter((v): v is string | number => v !== undefined && v !== null))];
return info.?.[cond] as (string | number)[] | undefined;
}
/** 만드는 중인 것이 모든 식에서 받는 설계 입력 이름들(등장 차례) — 이름 · 모양 */
@@ -216,12 +215,12 @@ export function buildRow(d: Draft): LogicRow {
const row: LogicRow = {
: "",
원문번호: d.section,
구분: d.book,
: "자체",
: "자체",
: "",
이름: d.name.trim(),
결과단위: d.unit.trim(),
출처: source,
: "개인",
: "현장",
입력: collectInputs(d).map((s) => inputOf(s, d.meta[s.name])),
중간: d.middles.map((m): NamedFormula => ({ 이름: m.name, : middleText(m), 출처: source })),
};
@@ -243,7 +242,7 @@ export function buildRow(d: Draft): LogicRow {
row. = d.extras
.filter((e) => e.name.trim() && isNumber(e.pct))
.map((e) => extraOf(e, source));
row. = d.round || null;
Object.assign(row, { 끝수: d.round ? { : "계", 자리: 0, 방법: d.round } : null });
} else row. = { : qtyText(d.result) };
return row;
}