fix(m02): 셀 밀기 · 당기기에 이름 따라감 · 카드 도면 저장도 표 없는 연결표 줄 뺌(114-2)

- 칸 삽입 · 삭제 창(밀기 · 당기기) — 띠 안에 통째로 든 이름정의 범위를 같이 옮김 · 되돌리기 한 걸음
- 연결표 맞춤 몸을 fitLinks 로 떼어 도면 상세 · 카드 도면 저장이 같이 씀
- 시험 — 밀기 여섯 갈래 · 카드 저장 줄 빼기

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
This commit is contained in:
2026-10-08 18:28:48 +09:00
co-authored by Claude Opus 5.5
parent f44789c33c
commit ad511175bf
5 changed files with 133 additions and 24 deletions
@@ -401,20 +401,29 @@ export function createAreaToDrawing(opt: AreaToDrawingOptions): AreaToDrawing {
withLinks: (doc) => {
waiting = false;
const { 지운연결: _dropped, ...doc_ } = doc;
doc = doc_;
const old = new Map((doc.연결표 ?? []).map((row) => [row.연결, row]));
const rows: TableLink[] = [];
for (const [sheet, entities] of sheetsOf(doc)) {
for (const e of entities) {
if (!isTable(e)) continue;
const id = linkOf(e);
const row = id ? (old.get(id) ?? fresh.get(id)) : undefined;
if (!id || !row || rows.some((r) => r.연결 === id)) continue;
rows.push({ ...row, 장: sheet, 값: latest.get(id) ?? row.값 });
}
}
// 기록이 없던 도면은 칸을 안 만듦(옛 문서 그대로)
return rows.length || doc.연결표 ? { ...doc, 연결표: rows } : doc;
return fitLinks(doc_, fresh, latest);
},
};
}
/** 도면 저장 문서 `연결표` 를 도면에 남은 표에 맞춤 — 표 없는 줄은 뺌 · 줄 `장` = 표가 놓인 장 ·
* `fresh` = 새로 놓은 표 줄 · `latest` = [업데이트]로 바뀐 값(도면 상세) · 카드 도면 저장도 이 몸(114-2) */
export function fitLinks(
doc: StructureDoc,
fresh: ReadonlyMap<string, TableLink> = new Map(),
latest: ReadonlyMap<string, Record<string, string>> = new Map(),
): StructureDoc {
const old = new Map((doc.연결표 ?? []).map((row) => [row.연결, row]));
const rows: TableLink[] = [];
for (const [sheet, entities] of sheetsOf(doc)) {
for (const e of entities) {
if (!isTable(e)) continue;
const id = linkOf(e);
const row = id ? (old.get(id) ?? fresh.get(id)) : undefined;
if (!id || !row || rows.some((r) => r.연결 === id)) continue;
rows.push({ ...row, 장: sheet, 값: latest.get(id) ?? row.값 });
}
}
// 기록이 없던 도면은 칸을 안 만듦(옛 문서 그대로)
return rows.length || doc.연결표 ? { ...doc, 연결표: rows } : doc;
}