feat(b05,b06): 좌측 구조물 목록 맨 아래 [구조물 전체 삭제] — 빈 목록 숨김 · 공용 확인창 한 번 · 하나씩 지우기와 같은 길 (313)

- 목록 그리기(renderStructureList)가 맨 아래에 위험 단추 줄 — 목록이 비면 그리지 않음(다시 생기면 보임)
- 확인 「구조물 N개를 모두 지울까요?」(showConfirmDialog) · 취소 = 그대로
- 관(자동 횡단배수 · 손 배치) = 보기마다 관 빼기 길(B05 배수유역도 · B06 관 초안) · 구조물 = 정본 배열 비우고 알림 한 번 → 캐시 · [저장] 때 작업본
- 저장 길(초안 읽기 · [저장] · 서버 · 자동 배치)은 안 고침(312 조사 몫)
- 시험: test_313_clear_all 새로 · test_116 기대값(return { startNew, clearAll })

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
This commit is contained in:
2026-10-13 18:38:50 +09:00
co-authored by Claude Opus 5.5
parent b93a9ee24d
commit 3de9ca043a
7 changed files with 316 additions and 3 deletions
@@ -14,6 +14,7 @@ import { asRoad } from "./B05_Profile_UI_Structures_Define";
import { readState, writeState } from "../A00_Common/b_page_state";
import { NO_SELECTION, PIPE_MATCH_M, selectDesign } from "../A00_Common/design/design_selection";
import { readGroupItems, readSummaryItem } from "../common_util/common_util_summary_item";
import { showConfirmDialog } from "@ui/ui_template_elements";
/** 배선에 필요한 패널 내부 값 — 이름은 분리 전 지역변수와 같다. */
/** 배선에 필요한 값 — 저장 쪽(`StructuresCommitContext`)과 겹치는 것은 그대로 물려받는다. */
@@ -38,6 +39,7 @@ export interface StructuresEventContext extends StructuresCommitContext {
export function bindStructuresEvents(ctx: StructuresEventContext): {
startNew: (group: string, typeId?: string) => void;
clearAll: () => Promise<void>;
} {
/** 새로 놓기(54-32) — 고름 · 측점 · 강조를 풀고 군(· 종류)만 남긴 빈 기본값 폼. */
function startNew(group: string, typeId?: string): void {
@@ -224,6 +226,20 @@ export function bindStructuresEvents(ctx: StructuresEventContext): {
}
});
/** [구조물 전체 삭제](313) — 확인 한 번 · 목록 전부(자동 횡단배수 · 손 배치) · 하나씩 지우기와 같은 길
* (관 = 관 빼기 · 구조물 = 정본 배열 비우고 알림) · 캐시에만 · 작업본은 [저장] 때. */
async function clearAll(): Promise<void> {
const count = ctx.structures.length + ctx.pipeFacilities().length;
if (!count || !(await showConfirmDialog(`구조물 ${count}개를 모두 지울까요?`, "모두 삭제")))
return;
ctx.resetForm(); // 임시 배치 취소 · 폼 · 고름 풂
ctx.callbacks.onListRelease?.();
for (const pipe of [...ctx.pipeFacilities()]) ctx.callbacks.onPipeRemove(pipe.chainage_m);
if (!ctx.structures.length) return;
ctx.structures.splice(0, ctx.structures.length);
ctx.emit();
}
ctx.memoField.addEventListener("change", () => ctx.liveCommit());
return { startNew }; // 우클릭 추가도 새로 놓기에서 시작(116-1)
return { startNew, clearAll }; // 우클릭 추가도 새로 놓기에서 시작(116-1)
}