knowledge(마스터): 소요량·계수·로직에 구분·상세구분 — 표·줄마다 칸 · 갈래 목록은 서버가 줌

- 장 파일 137 개의 표 3,028 · 로직 1,351 줄에 구분(원문 + 부문 · 「건설품셈 공통」) · 상세구분(「03장 토공사」) 칸을 직접 둠 · 파일 머리의 부문·차례는 목록 차례로 남김
- 열 차례 — 표는 키 · 원문번호 · 구분 · 상세구분 · 이름 · 기준 · 출처 · 비고 · 조건 · 범위규칙 · 값칸 · 줄 · 주 · 그룹(맨 뒤) · 로직은 소유 다음에 비고
- 서버 — GET /subs?group= 이 구분·상세구분 목록(장 차례대로) · GET /tables 가 파일을 가로질러 구분·상세구분·찾기로 거르고 쪽 나눔 · GET /logics 도 구분·상세구분으로 거름 · 새 줄은 서버가 갈래를 채움 · 죽은 book 칸 걷어냄
- check_master 가 구분·상세구분이 파일 머리·이름과 맞는지 봄 · adopt 가 빌더 줄에 갈래를 찍어 되돌리기 시험 글자까지 같음 · _틀.md · 화면 계약 · 화면 트리 · 시험 같이 고침

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JgUhN55Z3BCYhUJTjwTNfj
This commit is contained in:
2026-09-20 16:30:48 +09:00
co-authored by Claude Opus 5
parent 9de61eb251
commit 10418ccbd4
154 changed files with 8227 additions and 8046 deletions
+32 -50
View File
@@ -1,20 +1,20 @@
/* =============================================================================
* M01_MasterData_UI_Logic_List.ts
* 왼쪽 로직 목록 — 원문 · 장 · 이름 찾기 · 막힘만 · 막힘(⛔)·고침(●) 표시
* 왼쪽 로직 목록 — 구분 · 상세구분 · 이름 찾기 · 막힘만 · 막힘(⛔)·고침(●) 표시
* 거르기는 화면에서(목록은 한 번 받음 · 391 줄 남짓)
* ========================================================================== */
import { el } from "@ui/ui_template_elements";
import { renderTree, type MakeRow, type TreeNode } from "./M01_MasterData_UI_Tree";
import type { LogicSummary } from "./M01_MasterData_UI_Logic_Api";
import type { LogicSummary, SubBrief } from "./M01_MasterData_UI_Logic_Api";
import { tx } from "./M01_MasterData_UI_Logic_Text";
export type ListMark = "edited" | "new" | "deleted";
export interface ListItem {
id: string;
book: string;
chapter: string;
sub: string;
detail: string;
key: string;
number: string;
name: string;
@@ -24,21 +24,22 @@ export interface ListItem {
export interface ListHandle {
root: HTMLElement;
setItems: (items: LogicSummary[]) => void;
setItems: (items: LogicSummary[], subs: SubBrief[]) => void;
/** 저장 안 한 새 로직도 목록 맨 위에 */
setMarks: (marks: Map<string, ListMark>, extra: ListItem[]) => void;
setActive: (id: string | null) => void;
}
export const logicId = (book: string, key: string): string => `${book}\n${key}`;
export const logicId = (sub: string, key: string): string => `${sub}\n${key}`;
export function buildList(onOpen: (item: ListItem) => void): ListHandle {
let items: ListItem[] = [];
let subs: SubBrief[] = [];
let extra: ListItem[] = [];
let marks = new Map<string, ListMark>();
let active: string | null = null;
/** 트리에서 고른 범위 — 원문 · 부문 · 장(비면 전체) */
const pick = { book: "", division: "", chapter: "" };
/** 트리에서 고른 범위 — 구분 · 상세구분(비면 전체) */
const pick = { sub: "", detail: "" };
const tree = el("div", { className: "m01-logic__tree" });
const search = el("input", {
className: "m01-logic__input",
@@ -48,11 +49,8 @@ export function buildList(onOpen: (item: ListItem) => void): ListHandle {
const count = el("span", { className: "m01-logic__muted" });
const list = el("ul", { className: "m01-logic__list" });
const divisionOf = (chapter: string): string => /^(\S+) \d+장/.exec(chapter)?.[1] ?? "";
const inPick = (x: ListItem): boolean =>
(!pick.book || x.book === pick.book) &&
(!pick.division || divisionOf(x.chapter) === pick.division) &&
(!pick.chapter || x.chapter === pick.chapter);
(!pick.sub || x.sub === pick.sub) && (!pick.detail || x.detail === pick.detail);
const make: MakeRow = (node, caret, depth, onClick) => {
const button = el("button", {
@@ -77,13 +75,12 @@ export function buildList(onOpen: (item: ListItem) => void): ListHandle {
return button;
};
let pickId = "";
/** 원문 › 부문 › 장 — 눌러 범위를 고름 */
/** 전체 › 구분 › 상세구분 — 눌러 범위를 고름(갈래 목록은 서버가 준 것) */
const drawTree = (): void => {
const count = (f: (x: ListItem) => boolean): number => items.filter(f).length;
const books = [...new Set(items.map((x) => x.book))];
const set = (id: string, book: string, division: string, chapter: string): void => {
const set = (id: string, sub: string, detail: string): void => {
pickId = id;
Object.assign(pick, { book, division, chapter });
Object.assign(pick, { sub, detail });
draw();
};
const nodes: TreeNode[] = [
@@ -92,35 +89,19 @@ export function buildList(onOpen: (item: ListItem) => void): ListHandle {
label: tx("List_AllBooks"),
count: items.length,
open: true,
run: () => set("all", "", "", ""),
children: books.map((b): TreeNode => {
const chapters = [...new Set(items.filter((x) => x.book === b).map((x) => x.chapter))];
const leaf = (c: string, label: string): TreeNode => ({
id: `${b}|${c}`,
label,
count: count((x) => x.book === b && x.chapter === c),
run: () => set(`${b}|${c}`, b, "", c),
});
const divisions = [...new Set(chapters.map(divisionOf).filter(Boolean))];
return {
id: b,
label: b,
count: count((x) => x.book === b),
run: () => set(b, b, "", ""),
children: [
...chapters.filter((c) => !divisionOf(c)).map((c) => leaf(c, c)),
...divisions.map((d): TreeNode => ({
id: `${b}|#${d}`,
label: d,
count: count((x) => x.book === b && divisionOf(x.chapter) === d),
run: () => set(`${b}|#${d}`, b, d, ""),
children: chapters
.filter((c) => divisionOf(c) === d)
.map((c) => leaf(c, c.slice(d.length + 1))),
})),
],
};
}),
run: () => set("all", "", ""),
children: subs.map((s): TreeNode => ({
id: s.name,
label: s.name,
count: count((x) => x.sub === s.name),
run: () => set(s.name, s.name, ""),
children: s.details.map((d) => ({
id: `${s.name}|${d}`,
label: d,
count: count((x) => x.sub === s.name && x.detail === d),
run: () => set(`${s.name}|${d}`, s.name, d),
})),
})),
},
];
tree.replaceChildren(...renderTree(nodes, make));
@@ -159,7 +140,7 @@ export function buildList(onOpen: (item: ListItem) => void): ListHandle {
children: [
el("span", {
className: "m01-logic__muted",
text: `${item.book} ${item.chapter} · ${item.number}`,
text: `${item.sub} ${item.detail} · ${item.number}`,
}),
el("span", { text: item.name || item.number || item.key }),
el("span", { className: "m01-logic__badges", children: badges }),
@@ -192,11 +173,12 @@ export function buildList(onOpen: (item: ListItem) => void): ListHandle {
root.prepend(tree);
return {
root,
setItems: (logics) => {
setItems: (logics, kinds) => {
subs = kinds;
items = logics.map((x) => ({
id: logicId(x.book, x.키),
book: x.book,
chapter: x.chapter,
id: logicId(x.구분, x.키),
sub: x.구분,
detail: x.상세구분,
key: x.키,
number: x.원문번호,
name: x.이름,