39-5 H1 · H6 — 전체 항목 · 복사 생성 · 항목 하나 복사가 같이 쓸 목록 하나. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PSXsvyDxjNmufteN5bqmt
66 lines
2.7 KiB
JavaScript
66 lines
2.7 KiB
JavaScript
/* M02 항목 목록(`M02_MasterTemplete_ItemList.ts`) 칸 · 찾기 · 쪽 단위검증 헬퍼 — 트랜스파일해 Node 로 돌리고
|
|
* JSON 으로 냄. 화면 부품(ui_template · M01 머리 · css)은 빈 것으로 갈음 · 나무 자료(`TreePanel_Model`)는 진짜. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const M02 = path.join(__dirname, "..", "..", "M02_MasterTemplete");
|
|
const load = (name, stubs) => {
|
|
const js = ts.transpileModule(fs.readFileSync(path.join(M02, name), "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
const need = (id) => (id in stubs ? stubs[id] : {});
|
|
new Function("exports", "module", "require", js)(box.exports, box, need);
|
|
return box.exports;
|
|
};
|
|
const model = load("M02_MasterTemplete_TreePanel_Model.ts", {});
|
|
const m = load("M02_MasterTemplete_ItemList.ts", {
|
|
"./M02_MasterTemplete_TreePanel_Model": model,
|
|
});
|
|
|
|
const row = (열, 경로, extra = {}) => ({
|
|
key: `SS-${열}`,
|
|
열,
|
|
경로,
|
|
이름: 경로.join(" "),
|
|
단위: "m",
|
|
도번: `SD-${열}`,
|
|
면적번: `SA-${열}`,
|
|
수정일: { structure: "2026-10-01T09:00:00", area: "2026-10-03T10:00:00" },
|
|
labor: null,
|
|
...extra,
|
|
});
|
|
const rows = [
|
|
row("c1", ["기슭막이", "메쌓기", "1.2m"], {
|
|
labor: { 번호: "SU-000001", 로직수: 3, 합계: 1234567.4 },
|
|
수정일: { structure: "2026-10-01T09:00:00", labor: "2026-10-04T11:00:00" },
|
|
}),
|
|
row("c2", ["기슭막이", "찰쌓기"], { labor: { 번호: "SU-000002", 로직수: 0, 합계: null } }),
|
|
row("c3", ["옹벽"], { 도번: "", 수정일: {} }),
|
|
];
|
|
const cells = (kind) => rows.map((r) => m.ITEM_COLS[kind].map((c) => c.get(r)));
|
|
const many = Array.from({ length: 65 }, (_, i) => row(`n${i}`, ["배수", `측구 ${i}`]));
|
|
|
|
process.stdout.write(
|
|
JSON.stringify({
|
|
heads: Object.fromEntries(
|
|
Object.entries(m.ITEM_COLS).map(([k, cols]) => [k, cols.map((c) => c.head)]),
|
|
),
|
|
cells: {
|
|
structure: cells("structure"),
|
|
area: cells("area"),
|
|
labor: cells("labor"),
|
|
item: cells("item"),
|
|
},
|
|
find: m.pageOf(rows, m.ITEM_COLS.structure, "기슭 찰", 1).shown.map((r) => r.열),
|
|
findLabor: m.pageOf(rows, m.ITEM_COLS.labor, "SU-000001", 1).shown.map((r) => r.열),
|
|
findNone: m.pageOf(rows, m.ITEM_COLS.structure, "없는말", 1),
|
|
page3: (({ page, total, shown }) => ({ page, total, n: shown.length }))(
|
|
m.pageOf(many, m.ITEM_COLS.structure, "", 3),
|
|
),
|
|
pageOver: m.pageOf(many, m.ITEM_COLS.structure, "", 9).page,
|
|
pageEmpty: m.pageOf([], m.ITEM_COLS.structure, "", 2).page,
|
|
}),
|
|
);
|