Merge remote-tracking branch 'origin/main_laptop_1' into sub_laptop_6

This commit is contained in:
2026-09-30 20:25:12 +09:00
9 changed files with 211 additions and 14 deletions
@@ -33,6 +33,7 @@ import {
getActiveLayer,
readTemplate,
type StructureNumbers,
type TreeEdit,
} from "./M02_MasterTemplete_Api_Fetch";
import {
createItemCards,
@@ -221,6 +222,18 @@ export function comboMerge<T>(stored: unknown, edited: T): T {
} as unknown as T;
}
/** 표 머리 이름 칸 고침 → 나무 이름 바꾸기(PLAN 31-1 · 한 정본 = 나무) — 칸이 항목 이름(가장 깊은 칸)이면
* 항목(열 id 로 부름) · 위 칸이면 그 폴더(머리 앞마디 경로). */
export function headRenameEdit(col: StructureColumn, level: number, name: string): TreeEdit {
const named = (parts: (string | null)[]): string[] =>
parts.filter((p): p is string => !!p && p.trim() !== "");
const path = named(col.머리);
const upto = named(col.머리.slice(0, level + 1));
return upto.length >= path.length
? { op: "rename", 경로: path.slice(0, -1), 키: col.id, 이름: name }
: { op: "rename", 경로: upto, 이름: name };
}
/** 구조물 이름 + 변수값 — 제목행 층을 빈칸으로 이음(빈 층은 건너뜀 · 다 비면 열 id) */
export const columnHead = (col: StructureColumn): string =>
col.머리.filter((part): part is string => !!part && part.trim() !== "").join(" ") || col.id;