From d9a57338655ae3fe564b9b00fc32c5dbccc976f9 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 13:27:48 +0900 Subject: [PATCH] =?UTF-8?q?fix(m01-sl):=20=EA=B0=80=EC=A0=B8=EC=98=A8=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=9E=A5=EB=B9=84=20=EB=8B=A8=EA=B0=80?= =?UTF-8?q?=EA=B0=80=200=20=EC=9D=B4=EB=8D=98=20=ED=9D=A0=20=E2=80=94=20?= =?UTF-8?q?=EB=84=98=EA=B8=B8=20=EC=9E=85=EB=A0=A5=EA=B0=92=EC=9D=84=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=EA=B0=92=EC=9C=BC=EB=A1=9C=20=C2=B7=20?= =?UTF-8?q?=EB=B0=94=EB=80=8C=EB=A9=B4=20=EB=B0=94=EA=B9=A5=20=EA=B0=92=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=EB=B0=9B=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016PSXsvyDxjNmufteN5bqmt --- .../SheetLogic/M01_SL_Entry_Paper.ts | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts b/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts index a5012a1b3..f53097022 100644 --- a/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts +++ b/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts @@ -32,7 +32,8 @@ export const loadMods = () => import("./M01_SL_Item"), import("./M01_SL_Result"), import("./M01_SL_Import"), - ]).then(([model, ev, api, diagram, panel, table, item, result, imp]) => ({ + import("../../A00_Common/spreadsheet/spreadsheet_recalc"), + ]).then(([model, ev, api, diagram, panel, table, item, result, imp, recalc]) => ({ model, ev, api, @@ -42,6 +43,7 @@ export const loadMods = () => item, result, imp, + recalc, })); export type Mods = Awaited>; @@ -109,7 +111,8 @@ export function outsidePlaces(M: Mods, sl: SheetLogic): SlOutsideAt[] { if (node && c.source) put({ item: { id: c.id, ...c.source } as SlQuery, sheet: node.sheetId, cell: c.cell }); } - M.imp.outsideOf(sl).forEach(put); + // 넘길 입력값이 수식 칸이면 계산값이 있어야 함(없으면 null 로 넘어가 단가가 0) + M.imp.outsideOf(sl, M.recalc.recalcWorkbook(sl.workbook)).forEach(put); return [...at.values()]; } @@ -167,6 +170,29 @@ export function showPaper( let values: SlEvalResult; let busy = false; let notes = ctx.notes; + /** 마지막으로 받은 바깥 값 물음 — 넘길 입력값이 바뀌면 다시 받음 */ + const sigOf = (x: SheetLogic): string => + JSON.stringify(outsidePlaces(M, x).map((p) => [p.sheet, p.cell, p.item])); + let outsideSig = sigOf(first); + let outsideTimer: ReturnType | undefined; + /** 바깥 값 다시 받기 — 같은 조작의 뒤끝이라 기록을 더 쌓지 않음 */ + const refreshOutside = (): void => { + const sig = sigOf(sl); + if (sig === outsideSig) return; + outsideSig = sig; + clearTimeout(outsideTimer); + outsideTimer = setTimeout(() => { + const from = sl; + void fillOutside(M, from).then(({ sl: next, errors }) => { + if (sl !== from) return; // 그 사이 또 바뀜 — 다음 그리기가 다시 받음 + if (savedSl === from) savedSl = next; + sl = next; + outsideSig = sigOf(next); + notes = errors; + redraw(); + }); + }, 300); + }; const unsaved = createTag(tp("Unsaved"), "warning"); const note = el("p", { className: "m01-sl__note", attrs: { role: "status" } }); @@ -267,6 +293,7 @@ export function showPaper( const redraw = (): void => { values = evalNow(); + refreshOutside(); unsaved.hidden = sl === savedSl; undo.disabled = !stack.length; deleteButton.hidden = !sl.key;