From b114ad13e6596c2b8a67d42fb028e86e4d6b5e60 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 11:45:54 +0900 Subject: [PATCH] =?UTF-8?q?feat(m01-lb):=20Entry=20=EB=A5=BC=20LB=20?= =?UTF-8?q?=ED=83=80=EC=9E=85(LbLogic=20=C2=B7=20LbTables)=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=A7=9E=EC=B6=A4=20=C2=B7=20=EA=B8=88=EC=95=A1=20?= =?UTF-8?q?=ED=95=A9=EA=B3=84=20=EC=B9=B8=20=EA=B3=A0=EC=B9=A8?= 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 --- M01_MasterData/LogicBuilder/M01_LB_Entry.ts | 32 +++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/M01_MasterData/LogicBuilder/M01_LB_Entry.ts b/M01_MasterData/LogicBuilder/M01_LB_Entry.ts index c17d9f8de..0ceb0e6cd 100644 --- a/M01_MasterData/LogicBuilder/M01_LB_Entry.ts +++ b/M01_MasterData/LogicBuilder/M01_LB_Entry.ts @@ -28,6 +28,8 @@ import { type EasyListItem, } from "../EasyCalc/M01_EasyCalc_Api"; import { renderSheet } from "../EasyCalc/M01_EasyCalc_Sheet"; +import { lbCalcLater, type LbTables } from "./M01_LB_Api"; +import { readLogic, type LbLogic } from "./M01_LB_Blocks"; import "./M01_LB_Entry.css"; const TEXT = { @@ -104,15 +106,36 @@ const amountOf = (resultUnit: string): string => { }; const isMoney = (resultUnit: string): boolean => resultUnit.startsWith("원/"); -/** 고치는 화면이 쥔 것 — 2걸음에 Blocks 의 LbLogic 으로 바꿈 */ +/** 고치는 화면이 쥔 것 — row = 저장할 로직 줄 · lb = 블록(못 읽으면 null) · tables = 고친 표 사본(저장 안 함) */ interface Paper { key: string; version: string; isBase: boolean; row: LogicRow; trial: Record; + lb: LbLogic | null; + tables: LbTables; } +/* ponytail: Blocks(sub7) · LB Api(sub4) 속이 「준비 중」 인 동안만 대신함 — 채워지면 두 catch 를 지움 */ +const blocksOf = (row: LogicRow, key: string, version: string, isBase: boolean): LbLogic | null => { + try { + return readLogic(row, { key, version, isBase }); + } catch { + return null; + } +}; +const calcWith = ( + p: Paper, + onDone: (ans: CalcAnswer | null, plain: string | null) => void, +): void => { + try { + lbCalcLater(p.row, p.trial, p.tables, onDone); + } catch { + calcLater(p.row, p.trial, onDone); + } +}; + /** 「쉬운 단가산출(시험)」 옆에 놓는 단추 — 누르면 큰 창 */ export function createLogicBuilderButton(): HTMLButtonElement { return createButton({ label: te("Open"), variant: "filled", onClick: openLogicBuilder }); @@ -241,7 +264,8 @@ function openLogicBuilder(): void { body.replaceChildren(el("p", { className: "m01-lb__muted", text: te("Loading") })); try { const opened = await openEasy(key); - paper = { key, ...opened }; + const lb = blocksOf(opened.row, key, opened.version, opened.isBase); + paper = { key, ...opened, lb, tables: {} }; dirty = false; showPaper(); } catch (error) { @@ -282,7 +306,7 @@ function openLogicBuilder(): void { const calc = (): void => { drawResult(true); - calcLater(p.row, p.trial, (next, plain) => { + calcWith(p, (next, plain) => { ans = next; note.textContent = plain ?? ""; drawResult(false); @@ -301,6 +325,8 @@ function openLogicBuilder(): void { isBase: false, row: saved.row, trial: p.trial, + lb: blocksOf(saved.row, saved.key, saved.version, false), + tables: {}, }; logics = null; showToast(te("Copied"), "success");