From bb4500b4c327f54eb61ad9c8780db67e6462a396 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 24 Sep 2026 09:21:29 +0900 Subject: [PATCH] =?UTF-8?q?fix(M01):=20=EC=9E=90=EB=8F=99=EA=B0=92=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=ED=82=A4=20=EA=B0=92=20=C2=B7=20=ED=91=9C?= =?UTF-8?q?=20=EC=95=8C=EC=95=BD=20=EB=AA=A8=EB=8B=AC=20=EC=B0=B8=EC=A1=B0?= =?UTF-8?q?.=ED=96=89=20=3D=20=EC=B0=BE=EA=B8=B0=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=A4=84=20=EC=B0=BE=EC=95=84=20=EC=B9=A0?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01EY2vdBQkHjdih9GgCsp9Fd --- .../M01_MasterData_UI_LogicLab_Modal.ts | 20 ++++++++++++++++--- M01_MasterData/M01_MasterData_UI_Logic_Api.ts | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/M01_MasterData/M01_MasterData_UI_LogicLab_Modal.ts b/M01_MasterData/M01_MasterData_UI_LogicLab_Modal.ts index 2eba698a..f392be09 100644 --- a/M01_MasterData/M01_MasterData_UI_LogicLab_Modal.ts +++ b/M01_MasterData/M01_MasterData_UI_LogicLab_Modal.ts @@ -57,21 +57,35 @@ export interface ModalTarget { export interface TableTarget { title: string; table: string; - /** 찾은 줄 — 줄의 키·원문번호 글, 또는 줄 차례(0부터) */ - row?: string | number | null; + /** 찾은 줄 — 찾기 조건(예 {구분: 합판}) · 줄의 키·원문번호 글 · 줄 차례(0부터) */ + row?: Record | string | number | null; /** 찾은 값 칸 이름 */ col?: string | null; } +const sameCond = (have: unknown, want: unknown, range: boolean): boolean => { + if (range && Array.isArray(have)) { + const n = Number(want); + const [low, high] = have as (number | null)[]; + return (low == null || n >= low) && (high == null || n <= high); + } + return String(have) === String(want); +}; + function tableView(table: TableRow, target: TableTarget): HTMLElement { const lines = table.줄 ?? []; const at = target.row; + const kinds = table.조건 ?? {}; const hit = at === undefined || at === null ? null : typeof at === "number" ? (lines[at] ?? null) - : (lines.find((line) => line["키"] === at || line["원문번호"] === at) ?? null); + : typeof at === "string" + ? (lines.find((line) => line["키"] === at || line["원문번호"] === at) ?? null) + : (lines.find((line) => + Object.entries(at).every(([c, want]) => sameCond(line[c], want, kinds[c] === "범위")), + ) ?? null); const cols = [...Object.keys(table.조건 ?? {}), ...Object.keys(table.값칸 ?? {})]; const rows = lines.map((line) => el("tr", { diff --git a/M01_MasterData/M01_MasterData_UI_Logic_Api.ts b/M01_MasterData/M01_MasterData_UI_Logic_Api.ts index 5d478add..1626f95d 100644 --- a/M01_MasterData/M01_MasterData_UI_Logic_Api.ts +++ b/M01_MasterData/M01_MasterData_UI_Logic_Api.ts @@ -210,8 +210,8 @@ export const fetchMaterials = (cond: { /** 자동값 길(`GET /logic/auto`) — 입력 이름 → 견본값 · 서버에 아직 없거나 값이 없으면 빈 채로(화면은 그냥 안 채움) */ export const fetchAuto = (key: string): Promise> => - request<{ 입력?: Record }>(`/logic/auto?${query({ key })}`) - .then((d) => d.입력 ?? {}) + request<{ 값?: Record }>(`/logic/auto?${query({ key })}`) + .then((d) => d.값 ?? {}) .catch(() => ({})); export const runCalc = (body: {