fix(m02): 이름 없는 옛 보낸 범위 연결 — 면적 열 때 도면_{연결} 이름 · 면적 저장 때 연결표 줄에 이름(114-1)

- 면적 상세를 열 때 화면이 이름 없는 보낸 범위마다 책에 이름정의를 둠(고침 표시 없음) · 그 이름으로 점선
- 면적 [저장] 때 서버 refresh_drawing 이 책에 도면_{연결} 이 있으면 연결표 줄에 이름 적음
- 옛 줄 시험 기대 뒤집음 · 새 시험(옛 연결 → 열기 → 행 넣기 → 저장 → 도면 표 값 따라감)

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:26:34 +09:00
co-authored by Claude Opus 5.5
parent 5f64633df3
commit f44789c33c
5 changed files with 195 additions and 6 deletions
@@ -31,6 +31,7 @@ import {
type StructureDoc,
} from "./M02_MasterTemplete_Api_Fetch";
import type { LinkOptions } from "../A00_Common/spreadsheet/spreadsheet";
import type { Workbook } from "../A00_Common/spreadsheet/spreadsheet_types";
import type { Selection } from "./M02_MasterTemplete_UI_Main";
/** 표 칸 하나(CAD `TableCell` 꼴에서 쓰는 것만) */
@@ -141,18 +142,41 @@ export const sameValues = (
return ka.length === Object.keys(b).length && ka.every((k) => a[k] === b[k]);
};
/** 면적 시트에 겹쳐 보일 「도면으로 보낸 범위」 — 같은 열 도면 `연결표` 에서(받기 실패 = 없음 · 조용히) */
/** 이름 없는 옛 연결(114-1) — 책에 `도면_{연결}` 이름정의를 적힌 범위로 둠(이미 있으면 그대로) → 그 이름.
* 책을 바로 고침(화면에 싣기 전 · 「저장 안 한 고침」 아님) · 서버는 면적 [저장] 때 그 이름을 연결표 줄에 적음 */
async function nameOld(book: Workbook, row: TableLink): Promise<string | undefined> {
const name = `${NAME}${row.연결}`;
const low = name.toLowerCase();
if (book.시트.some((s) => s.이름정의?.some((n) => n.이름.toLowerCase() === low))) return name;
const { parseRange } = await import("../A00_Common/spreadsheet/spreadsheet_address");
const sheet = book.시트.find((s) => s.id === row.시트);
const g = parseRange(row.범위);
if (!sheet || !g) return undefined; // 못 풂 — 적힌 범위로(옛 그대로)
sheet.이름정의 = [...(sheet.이름정의 ?? []), { 이름: name, 범위: g }];
return name;
}
/** 면적 시트에 겹쳐 보일 「도면으로 보낸 범위」 — 같은 열 도면 `연결표` 에서(받기 실패 = 없음 · 조용히) ·
* `book`(면적 책 · 화면에 싣기 전) 있으면 이름 없는 옛 연결에 이름을 둠(114-1 · 행열 넣기를 따라감) */
export async function sentRanges(
at: Selection,
onCancel: (연결: string) => void,
book?: Workbook,
): Promise<NonNullable<LinkOptions["표시범위"]>> {
try {
const got = await readTemplate(at.layer, "structure", at.name, at.projectId);
const rows = (got.문서 as StructureDoc | undefined)?.연결표 ?? [];
return rows.map((row) => ({
const names = await Promise.all(
rows.map((row) =>
row.이름 || !book || !Array.isArray(book.시트)
? row.이름
: nameOld(book, row).catch(() => undefined),
),
);
return rows.map((row, i) => ({
시트: row.시트,
범위: row.범위,
범위이름: row.이름,
범위이름: names[i],
이름: fill(TEXT.tag, "id", row.연결),
설명: fill(fill(fill(TEXT.tip, "id", row.연결), "range", row.범위), "size", row.글자크기),
취소: async () => (onCancel(row.연결), true), // 화면에서만 — 서버는 면적 [저장] 때