diff --git a/M01_MasterData/SheetLogic/M01_SL_Entry.ts b/M01_MasterData/SheetLogic/M01_SL_Entry.ts index d8ac397c7..3398ed630 100644 --- a/M01_MasterData/SheetLogic/M01_SL_Entry.ts +++ b/M01_MasterData/SheetLogic/M01_SL_Entry.ts @@ -17,8 +17,8 @@ import { } from "@ui/ui_template_elements"; import { openModal } from "@ui/ui_template_modal"; import { listEasy, plainError, type EasyListItem } from "../EasyCalc/M01_EasyCalc_Api"; -import { slList, type SlListItem } from "./M01_SL_Api"; -import { newLogic, type SheetLogic } from "./M01_SL_Model"; +import type { SlListItem } from "./M01_SL_Api"; +import type { SheetLogic } from "./M01_SL_Model"; import "./M01_SL_Entry.css"; const TEXT = { @@ -76,15 +76,12 @@ const amountOf = (resultUnit: string): string => { }; const isMoney = (resultUnit: string): boolean => resultUnit.startsWith("원/"); -/* ponytail: SL Api(sub4) · Model(sub7) 속이 「준비 중」 인 동안만 대신함 — 채워지면 두 catch 를 지움 */ -const loadMine = (): Promise => slList().catch(() => []); -const blankLogic = (name: string, unit: string): SheetLogic | null => { - try { - return newLogic(name, unit); - } catch { - return null; - } -}; +/* SheetLogic 파일은 늦게 불러옴(import()) — 스프레드시트 엔진이 M01 첫 묶음에 안 들어가게. + * ponytail: SL Api(sub4) · Model(sub7) 속이 「준비 중」 인 동안만 빈 목록 · null 로 대신함 — 채워지면 catch 를 지움 */ +const loadMine = (): Promise => + import("./M01_SL_Api").then((m) => m.slList()).catch(() => []); +const blankLogic = (name: string, unit: string): Promise => + import("./M01_SL_Model").then((m) => m.newLogic(name, unit)).catch(() => null); /** 「로직 만들기(시험)」 옆에 놓는 단추 — 누르면 큰 창 */ export function createSheetLogicButton(): HTMLButtonElement { @@ -235,7 +232,9 @@ function openSheetLogic(): void { const showPaper = (): void => { let dirty = false; const units = unitChoices(); - paper = { dirty: () => dirty, sl: blankLogic("", units[0]) }; + const mine: { dirty(): boolean; sl: SheetLogic | null } = { dirty: () => dirty, sl: null }; + paper = mine; + void blankLogic("", units[0]).then((sl) => (mine.sl = sl)); const unsaved = createTag(te("Unsaved"), "warning"); unsaved.hidden = true;