Files
Aislo/B07_DesignDetail/B07_DesignDetail_UI_Development.ts
T
eomsangdonandClaude Opus 5.5 bb5f07eb0c feat(377-2 B07 전개도): 좌측 「전개도」 카드 · 목록 · 단건 · 확정본 kind — 늘 카드 · 구조물 종류마다 하위 묶음(이름 줄 + 형태 단추) · 목록 맨 뒤 · 전개도 id 면 측점별 설계 실어 그림
- Router_Support _drawing_list 맨 뒤 development_list · _read_drawing 분기 · 확정본 kind development
- Router 단건 = _designs_by_chainage · Schema · Api_Fetch kind development
- UI_Development.ts 새 카드(groupPlanSheets 재사용) · test_311 접힘 대조에 전개도 카드(기본 펼침)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
2026-10-17 14:53:45 +09:00

51 lines
2.3 KiB
TypeScript

/* =============================================================================
* B07_DesignDetail_UI_Development.ts
* 좌측 「전개도」 카드(요구 241 · PLAN 377) — 늘 카드 · 구조물 종류마다 하위 묶음(이름 줄 + 형태 단추).
*
* 묶음 = `groupPlanSheets`(plan_kind = 구조물 종류 · plan_kind_name = 이름) 재사용 · 모양 = 평면도 묶음 class.
* 단추 글 = 장 이름에서 종류 이름 · 「전개도」를 뺀 형태(전체 이름은 툴팁).
* ========================================================================== */
import { createPanelCard } from "@ui/ui_template_collapsible";
import type { DesignDrawingItem } from "./B07_DesignDetail_Api_Fetch";
import { groupPlanSheets } from "./B07_DesignDetail_UI_PlanKinds";
/** 「관보호공 돌쌓기(찰) 전개도 (2)」 → 「돌쌓기(찰) (2)」 · 포장 「콘크리트포장 전개도」 → 「콘크리트포장」. */
function shortLabel(label: string, kindName: string): string {
const rest = label.replace(" 전개도", "");
return rest.startsWith(`${kindName} `) ? rest.slice(kindName.length + 1) : rest;
}
export function buildDevelopmentSection(
items: DesignDrawingItem[],
makeButton: (drawing: DesignDrawingItem, label: string) => HTMLButtonElement,
collapsed = false,
): HTMLElement {
const section = createPanelCard(`전개도 ${items.length}`, collapsed);
section.classList.add("b07-drawing-group");
section.dataset.kind = "development";
if (items.length === 0) {
const empty = document.createElement("span");
empty.className = "b07-plan-kind__name";
empty.textContent = "종단 길이를 가진 구조물이 없습니다.";
section.append(empty);
return section;
}
for (const { kindId, name, sheets } of groupPlanSheets(items)) {
const block = document.createElement("div");
block.className = "b07-plan-kind";
block.dataset.planKind = kindId;
const title = document.createElement("span");
title.className = "b07-plan-kind__name";
title.textContent = name;
block.append(title);
for (const { drawing } of sheets) {
const button = makeButton(drawing, shortLabel(drawing.label, name));
button.title = drawing.label;
block.append(button);
}
section.append(block);
}
return section;
}