refactor(m02-df): 입력 판 자재 찾기를 서버 길(cfMaterials)로 — 대신 길 지움

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU
This commit is contained in:
2026-10-01 20:03:12 +09:00
co-authored by Claude Sonnet 5.5
parent 3e5dd641f1
commit 67e631ac8c
2 changed files with 6 additions and 78 deletions
@@ -21,12 +21,10 @@ import {
type SubInfo,
} from "../../M01_MasterData/M01_MasterData_Api_Fetch";
import { cfPlain, cfUserElementAdd, cfUserElements, cfValues } from "./M02_DF_Api";
import type { CfBox, CfElementRef, CfGroup, CfLogic } from "./M02_DF_Model";
import type { CfBox, CfGroup, CfLogic } from "./M02_DF_Model";
import {
GROUPS,
M01_OF,
MACHINE_SEP,
USER_PREFIX,
addElement,
elementOf,
machineFields,
@@ -243,39 +241,10 @@ function drawChosen(
if (node && a.ok && a.value !== null && a.value !== undefined)
node.textContent = typeof a.value === "number" ? fmt(a.value) : String(a.value);
}),
// Api 가 아직 값을 못 주면 M01 줄에서 바로 읽어 보임(값 칸만 — 요소는 그대로)
() =>
els.forEach(
(e) =>
void m01Value(group, e).then((v) => {
const node = values.get(e.ref);
if (node && v !== null) node.textContent = fmt(v);
}),
),
() => undefined, // 값을 못 받아도 요소는 넣을 수 있음 — 값 칸만 「—」
);
}
/** 요소 한 개의 값을 M01 줄에서 읽음 — 이름으로 찾아 키가 같은 줄 · 못 찾으면 null */
async function m01Value(group: CfGroup, e: CfElementRef): Promise<number | null> {
if (e.ref.startsWith(USER_PREFIX)) return null;
try {
const [key, field] = e.ref.split(MACHINE_SEP);
const page = await fetchRows(
await fileOf(group),
1,
30,
e.name.split(" · ")[0].split(" ")[0],
false,
"",
"",
);
const row = (page.rows as M01Row[]).find((r) => r["키"] === key);
return row ? valueOf(group, row, field || "가격") : null;
} catch {
return null;
}
}
/** M01 줄 찾기 — 구분 · 상세구분 · 이름 · 내가 만든 것도 함께 */
async function drawFind(
host: HTMLElement,
@@ -406,7 +375,6 @@ async function drawFind(
list,
);
void load();
void USER_PREFIX;
}
/** 새 요소 — M01 표 「추가」 화면 꼴(이름 · 규격 · 단위 · 값) · 마스터에 안 쓰고 사용자 요소로 */