From 913f04998eefc83dcc769908c09afb3d386f106e Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 13:01:58 +0900 Subject: [PATCH] =?UTF-8?q?feat(m01-sl):=20Entry=20=EB=A5=BC=20SL=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84(slList=20=C2=B7=20newLogic=20=C2=B7=20SheetL?= =?UTF-8?q?ogic)=EC=9C=BC=EB=A1=9C=20=EB=A7=9E=EC=B6=A4?= 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/SheetLogic/M01_SL_Entry.ts | 41 +++++++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/M01_MasterData/SheetLogic/M01_SL_Entry.ts b/M01_MasterData/SheetLogic/M01_SL_Entry.ts index 7078a7216..d8ac397c7 100644 --- a/M01_MasterData/SheetLogic/M01_SL_Entry.ts +++ b/M01_MasterData/SheetLogic/M01_SL_Entry.ts @@ -17,6 +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 "./M01_SL_Entry.css"; const TEXT = { @@ -74,6 +76,16 @@ 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; + } +}; + /** 「로직 만들기(시험)」 옆에 놓는 단추 — 누르면 큰 창 */ export function createSheetLogicButton(): HTMLButtonElement { return createButton({ label: te("Open"), variant: "filled", onClick: openSheetLogic }); @@ -82,7 +94,7 @@ export function createSheetLogicButton(): HTMLButtonElement { function openSheetLogic(): void { let body: HTMLElement; /** 고치는 화면이 열려 있을 때만 */ - let paper: { dirty(): boolean } | null = null; + let paper: { dirty(): boolean; sl: SheetLogic | null } | null = null; let logics: EasyListItem[] | null = null; let query = ""; @@ -110,15 +122,30 @@ function openSheetLogic(): void { return row; }; + const mineRow = (item: SlListItem): HTMLElement => { + const row = el("button", { + className: "m01-sl__item", + attrs: { type: "button" }, + children: [ + el("span", { className: "m01-sl__item-name", text: item.이름 }), + el("span", { className: "m01-sl__item-unit", text: item.결과단위 }), + ], + }); + row.addEventListener("click", notYet); + return row; + }; + const showStart = async (): Promise => { paper = null; const status = el("p", { className: "m01-sl__muted", text: te("Loading") }); const trialHost = el("div", { className: "m01-sl__list" }); const foundHost = el("div", { className: "m01-sl__list" }); - const mineHost = el("div", { - className: "m01-sl__list", - children: [muted(te("Start_MineNone"))], - }); + const mineHost = el("div", { className: "m01-sl__list" }); + void loadMine().then((mine) => + mineHost.replaceChildren( + ...(mine.length ? mine.map(mineRow) : [muted(te("Start_MineNone"))]), + ), + ); const search = createInputField({ type: "search", placeholder: te("Start_Search"), @@ -207,7 +234,8 @@ function openSheetLogic(): void { const showPaper = (): void => { let dirty = false; - paper = { dirty: () => dirty }; + const units = unitChoices(); + paper = { dirty: () => dirty, sl: blankLogic("", units[0]) }; const unsaved = createTag(te("Unsaved"), "warning"); unsaved.hidden = true; @@ -221,7 +249,6 @@ function openSheetLogic(): void { onInput: touched, }); name.root.classList.add("m01-sl__name"); - const units = unitChoices(); const unit = createSelectField({ label: te("Unit"), options: units.map((u) => ({ value: u, text: u.replace(/^원\//, "") })),