diff --git a/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts b/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts index ca3b354a0..2b4d7bdb2 100644 --- a/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts +++ b/M01_MasterData/SheetLogic/M01_SL_Entry_Paper.ts @@ -33,7 +33,8 @@ export const loadMods = () => import("./M01_SL_Result"), import("./M01_SL_Import"), import("../../A00_Common/spreadsheet/spreadsheet_recalc"), - ]).then(([model, ev, api, diagram, panel, table, item, result, imp, recalc]) => ({ + import("./M01_SL_LogicTools"), + ]).then(([model, ev, api, diagram, panel, table, item, result, imp, recalc, logic]) => ({ model, ev, api, @@ -44,6 +45,7 @@ export const loadMods = () => result, imp, recalc, + logic, })); export type Mods = Awaited>; @@ -109,13 +111,19 @@ export function outsidePlaces(M: Mods, sl: SheetLogic): SlOutsideAt[] { if (!at.has(k)) at.set(k, p); }; M.item.itemOutsides(sl).forEach(put); - for (const c of M.ev.outsideCells(sl)) { - const node = sl.nodes.find((n) => n.id === c.node); - if (node && c.source) - put({ item: { id: c.id, ...c.source } as SlQuery, sheet: node.sheetId, cell: c.cell }); - } + // 상자에 출처가 적힌 알약 → 넘길 값을 실은 물음(outsideOf) → 출처를 짐작한 나머지(넘길 값 없음) 차례 + const cells = M.ev.outsideCells(sl); + const fromCell = (explicit: boolean): void => { + for (const c of cells) { + const node = sl.nodes.find((n) => n.id === c.node); + if (node && c.source && !!node.source === explicit) + put({ item: { id: c.id, ...c.source } as SlQuery, sheet: node.sheetId, cell: c.cell }); + } + }; + fromCell(true); // 넘길 입력값이 수식 칸이면 계산값이 있어야 함(없으면 null 로 넘어가 단가가 0) M.imp.outsideOf(sl, M.recalc.recalcWorkbook(sl.workbook)).forEach(put); + fromCell(false); return [...at.values()]; } @@ -294,10 +302,6 @@ export function showPaper( }); }; - /* ponytail: 「다른 로직」 상자 손잡이(sub5 renderLogicTools)가 올라오기 전엔 없음 — 올라오면 바로 M.item.renderLogicTools 로 부름 */ - const logicTools = (M.item as { renderLogicTools?: typeof M.item.renderItemTools }) - .renderLogicTools; - const drawPanel = (): void => { const node = sl.nodes.find((n) => n.id === selected); if (!node) { @@ -323,8 +327,8 @@ export function showPaper( loadPrices(node.id); }, }); - else if (node.kind === "logic" && logicTools) - logicTools(toolsHost, sl, node.id, { + else if (node.kind === "logic") + M.logic.renderLogicTools(toolsHost, sl, node.id, { change: (next) => { edit(next, true); loadPrices(node.id);