- 좌측 「구조물 집계 양식」 아래 「항목 나무」 카드(세 층 공용 · 깊이 자유 · 검색 · 키보드 위아래 · 펼침 · F2 · Delete)
- 항목 누름 → 표 그 열 고름 + 카드 넷 · 표에서 열 고름 → 나무 표시
- 나무 고침 POST /api/m02/layers/{층}/tree · 판 409 다시 읽고 알림 · 저장 안 한 표 고침은 저장/버림/취소 물음
- 읽기만 층은 메뉴 · 키 없음 · 나무 메뉴 자리는 sub5 의 ui_template_tree 그대로
- 시험 test_m02_treepanel 8 · test_m02_layer_screen 문구 맞춤
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2nUMUMTsqm93PbQtipo6c
55 lines
2.0 KiB
JavaScript
55 lines
2.0 KiB
JavaScript
/* M02 항목 나무 자료(`M02_MasterTemplete_TreePanel_Model.ts`) 단위검증 헬퍼 — 트랜스파일해 Node 로 돌리고 JSON 으로 냄. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const file = path.join(__dirname, "..", "..", "M02_MasterTemplete", "M02_MasterTemplete_TreePanel_Model.ts");
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
new Function("exports", "module", "require", js)(box.exports, box, require);
|
|
const m = box.exports;
|
|
|
|
const item = (열, 경로, key) => ({ key, 열, 경로, 이름: 경로.join(" "), 단위: "m", 일위대가: null });
|
|
const view = {
|
|
판: "v1",
|
|
폴더: [["빈 폴더"], ["돌기슭막이", "빈 아래"]],
|
|
items: [
|
|
item("c1", ["돌기슭막이", "메쌓기", "1.2m"], "SS000001"),
|
|
item("c2", ["돌기슭막이", "찰쌓기"], "SS000002"),
|
|
item("c3", ["다섯", "둘", "셋", "넷", "잎"], "SS000003"),
|
|
item("c4", ["최상위 항목"], "SS000004"),
|
|
],
|
|
};
|
|
const shape = (n) => ({
|
|
path: n.path,
|
|
items: n.items.map((i) => i.열),
|
|
folders: n.folders.map(shape),
|
|
});
|
|
const all = m.buildFolders(view);
|
|
const found = m.buildFolders(view, "찰쌓기");
|
|
|
|
process.stdout.write(
|
|
JSON.stringify({
|
|
all: shape(all),
|
|
count: m.countItems(all),
|
|
found: shape(found),
|
|
foundCount: m.countItems(found),
|
|
none: shape(m.buildFolders(view, "없는말")),
|
|
folders: m.listFolders(all),
|
|
ancestors: m.ancestorsOf(view, "c3"),
|
|
ancestorsTop: m.ancestorsOf(view, "c4"),
|
|
ancestorsNone: m.ancestorsOf(view, "zz"),
|
|
under: [
|
|
m.isUnder(["a", "b"], ["a"]),
|
|
m.isUnder(["a"], ["a"]),
|
|
m.isUnder(["a"], ["a", "b"]),
|
|
m.isUnder(["x"], ["a"]),
|
|
],
|
|
leaf: m.leafName(view.items[0]),
|
|
dir: m.folderOf(view.items[0]),
|
|
byKey: m.buildFolders(view, "ss000003").items.length + m.buildFolders(view, "SS000003").folders.length,
|
|
}),
|
|
);
|