fix(M01): 자리 표시 든 요소 줄 모달 — 요소조각의 푼 키로 단가 · 날글 안 찍음 (PLAN 5장 다시 돌림 3)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
This commit is contained in:
2026-09-24 13:30:16 +09:00
co-authored by Claude Sonnet 5
parent c1181bc9b5
commit 5e9df81cbd
3 changed files with 39 additions and 4 deletions
@@ -101,6 +101,9 @@ interface Entry {
/** 서버 조각으로 그린 단가 자리 · 수량 풀이 — 줄 모달이 씀(붙기 전엔 없음) */
unitFrag?: Fragment[];
piecesFrag?: Fragment[];
/** 서버 요소조각의 첫 요소 — 자리 표시 든 줄이 입력으로 풀린 키 · 글 */
unitRef?: string;
unitText?: string;
}
/** 재료 고르기 줄 — `요소` 가 글 대신 {구분·상세구분·규격·대표} 객체 */
@@ -236,6 +239,8 @@ function entries(ctx: DetailContext): Entry[] {
open: (self) =>
openMaterialModal({
unitFrag: self.unitFrag,
unitRef: self.unitRef,
unitText: self.unitText,
qtyFrag: self.piecesFrag,
title: item.이름 ?? (cond ? condLabel(cond) : item.요소),
expr: item.수량,
@@ -304,7 +309,12 @@ function attachPieces(all: Entry[], ctx: DetailContext): void {
const line = [own, ...costs].map((c) => found.get(`${c}|${e.idx}`)).find(Boolean);
const pieces = line?.조각;
e.qtyFrag = e.piecesFrag = pieces?.length ? toFragments(pieces, ctx) : [];
if (line?.요소조각?.length) e.unitFrag = toFragments(line.요소조각, ctx);
if (line?.요소조각?.length) {
e.unitFrag = toFragments(line.요소조각, ctx);
const first = line.요소조각.find((piece) => piece.kind === "요소");
e.unitRef = first?.참조?.키;
e.unitText = first?.글;
}
}
}