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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user