From f9ac244b63dbb7f58abb1c5cf30cc5055fe95074 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 09:46:44 +0900 Subject: [PATCH] =?UTF-8?q?feat(m01-easycalc):=20Pick=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=EB=A5=BC=20=EC=89=AC=EC=9A=B4=20=EB=A7=90=EB=A1=9C=20=C2=B7=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20100=EC=A4=84=20=EC=A0=9C=ED=95=9C=20=C2=B7?= =?UTF-8?q?=20PLAN=2034-3b=20Pick=20=EA=B2=80=EC=A6=9D=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU --- M01_MasterData/EasyCalc/M01_EasyCalc_Pick.ts | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/M01_MasterData/EasyCalc/M01_EasyCalc_Pick.ts b/M01_MasterData/EasyCalc/M01_EasyCalc_Pick.ts index a7b9bc8cb..570e67dda 100644 --- a/M01_MasterData/EasyCalc/M01_EasyCalc_Pick.ts +++ b/M01_MasterData/EasyCalc/M01_EasyCalc_Pick.ts @@ -16,7 +16,7 @@ import { import { openModal } from "@ui/ui_template_modal"; import { fetchPick, fetchSubs, type SubInfo } from "../M01_MasterData_Api_Fetch"; import { fetchMaterials } from "../M01_MasterData_UI_Logic_Api"; -import { listEasy, listMachines, machineElement } from "./M01_EasyCalc_Api"; +import { listEasy, listMachines, machineElement, plainError } from "./M01_EasyCalc_Api"; import type { PickResult } from "./M01_EasyCalc_Model"; import "./M01_EasyCalc_Pick.css"; @@ -64,6 +64,8 @@ const te = (key: keyof typeof TEXT, vars: Record = {}): ); const won = (n: number): string => Math.round(n).toLocaleString("ko-KR"); +/** 목록에 그릴 줄 수 — 더 찾으려면 이름을 쳐서 좁힘 */ +const SHOW = 100; const MAT_FILE = "재료_자재품목.json"; /** 목록 한 줄 — 고르면 PickResult(수량 빼고) 를 만들어 줌 */ @@ -294,16 +296,17 @@ export function openEasyPick(kind?: Kind): Promise { return void list.replaceChildren( el("p", { className: "m01-easypick__muted", text: te("Hint") }), ); - count.textContent = te("Count", { n: found.total, m: found.items.length }); + const shown = found.items.slice(0, SHOW); + count.textContent = te("Count", { n: found.total, m: shown.length }); list.replaceChildren( - ...(found.items.length - ? found.items.map((c) => + ...(shown.length + ? shown.map((c) => rowOf(c, () => stepQty(k, c, back ? () => stepList(k, canBack) : null)), ) : [el("p", { className: "m01-easypick__muted", text: te("None") })]), ); - } catch { - if (mine === seq) showToast(te("Failed"), "error"); + } catch (e) { + if (mine === seq) showToast(plainError(e), "error"); } }; if (src.grouped) bar.unshift(...subFilters(filter, load)); @@ -348,7 +351,11 @@ export function openEasyPick(kind?: Kind): Promise { const submit = async (): Promise => { const n = parse(); if (n === null) return qty.setError(te("QtyBad")); - done({ ...(await c.make()), qty: n }); + try { + done({ ...(await c.make()), qty: n }); + } catch (e) { + qty.setError(plainError(e)); + } }; qty.input.addEventListener("input", refresh); qty.input.addEventListener("keydown", (ev) => ev.key === "Enter" && void submit());