merge: sub_desktop_1 52-10 — 충돌(명세 목록 · import) = 세월교 · 포장 둘 다

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJqWQpoB1RE7hiaQ2wH8qV
This commit is contained in:
2026-10-05 23:52:08 +09:00
co-authored by Claude Opus 5.5
12 changed files with 488 additions and 6 deletions
@@ -28,6 +28,7 @@ import {
createFacilityDefinition,
type FacilityDefinition,
} from "./B05_Profile_UI_Structures_Define_Form";
import { createStructureSpecForm } from "./B05_Profile_UI_Structures_Spec";
export interface StructuresFormElements {
root: HTMLElement;
@@ -164,6 +165,13 @@ export function buildStructuresForm(options: {
set: groupBoxes.setOne,
});
groupBoxes.watch(facilityOptions.paintLinks);
// 일반 구조물 명세 컨테이너(PLAN 52-10 · 노면공 등) — 잇기 · 반영 길은 배관 명세와 같음
const structureSpec = createStructureSpecForm(
optionRow,
{ get: groupBoxes.get, pick: groupBoxes.pick, clear: groupBoxes.clear, set: groupBoxes.setOne },
options.onFacilityChange,
);
groupBoxes.watch(structureSpec.paintLinks);
const staleBox = document.createElement("fieldset");
staleBox.className = "b05-structure__group b05-structure__stale";
staleBox.hidden = true;
@@ -175,6 +183,7 @@ export function buildStructuresForm(options: {
summary.root, // 종류 단위 「구조물 조합」 잇기 — 기준 측점 바로 아래(PLAN 52-1 · 컨테이너 없는 종류)
positionDivider,
optionRow,
structureSpec.root,
facilityOptions.root,
staleBox,
groupBoxes.root,
@@ -56,6 +56,12 @@ export function numberDuplicateNames(names: ReadonlyArray<string>): string[] {
});
}
/** 기타 = 사용자가 적은 상세 종류 이름(표 08 · 52-10) — 비었으면 null(종류 이름). */
function etcName(structure: StructureInstance): string | null {
const name = structure.type_id === "etc" ? String(structure.options?.name ?? "").trim() : "";
return name || null;
}
export function renderStructureList(params: StructureListParams): void {
const { list, typeMap, intervalM, editingId, selectedPipeChainage } = params;
list.replaceChildren();
@@ -89,7 +95,9 @@ export function renderStructureList(params: StructureListParams): void {
const displayNames = numberDuplicateNames(
rows.map((row) =>
row.kind === "structure"
? (typeMap.get(row.structure.type_id)?.name ?? row.structure.type_id)
? (etcName(row.structure) ??
typeMap.get(row.structure.type_id)?.name ??
row.structure.type_id)
: (typeMap.get(row.pipe.facility)?.name ?? row.pipe.facility),
),
);
@@ -18,6 +18,7 @@ import type { FacilityAttributes, FacilityOptionsForm } from "./B05_Profile_UI_D
import type { StationFields } from "./B05_Profile_UI_Structures_Fields";
import { splitPavementRange } from "./B05_Profile_UI_Structures_Pavement";
import { mergeStructureOptions } from "./B05_Profile_UI_Structures_Summary";
import { readStructureSpec, specRenderedKeys } from "./B05_Profile_UI_Structures_Spec";
import type { GroupBoxes } from "./B05_Profile_UI_Structures_Groups";
import {
readGroupItems,
@@ -40,6 +41,8 @@ export interface StructuresCommitContext {
startFields: StationFields;
endFields: StationFields;
facilityOptions: FacilityOptionsForm;
/** 옵션 칸 — 짝 명세 폼(52-10)을 찾는 열쇠. */
optionRow: HTMLElement;
optionInputs: Array<{
key: string;
required: boolean;
@@ -205,7 +208,7 @@ export function readOptions(ctx: StructuresCommitContext): Record<string, string
if (input.isEmpty()) return;
values[input.key] = input.read();
});
return values;
return { ...values, ...readStructureSpec(ctx.optionRow, ctx.currentType()) };
}
export function emit(ctx: StructuresCommitContext): void {
@@ -369,7 +372,11 @@ export async function commit(ctx: StructuresCommitContext, live = false): Promis
options: mergeStructureOptions(
previous,
type.type_id,
[...ctx.optionInputs.map((entry) => entry.key), ...ctx.groupBoxes.shapeKeys()],
[
...ctx.optionInputs.map((entry) => entry.key),
...ctx.groupBoxes.shapeKeys(),
...specRenderedKeys(type, previous.options), // 명세 폼 키(52-10) — 비운 칸 · 뺀 컨테이너는 지움
],
records[0].options,
),
};
@@ -22,6 +22,7 @@ import {
import { FORM_OPTION_KEYS } from "./B05_Profile_UI_Drainage_Facility_Merge";
import { STRUCTURE_SPECS } from "../A00_Common/design/design_structure_pipe";
import { specKeys } from "../A00_Common/design/design_structure_spec";
import { paintStructureSpec, specOwnedKeys } from "./B05_Profile_UI_Structures_Spec";
/** 종류 단위 「구조물 조합」 줄을 가릴 종류인지 — 구조물 명세 컨테이너 · 정의 그룹 상자(그룹마다 잇기 줄)로
* 그리는 종류(PLAN 52-1 · 52-6b) · 종단배수(B군 · 조합 잇기 없음 · 표 07). */
@@ -62,10 +63,15 @@ export function renderOptionFields(
optionRow.replaceChildren();
// 서브폼이 담당하는 타입(계곡 통과 시설·독립 기슭막이)은 여기서 그리지 않는다.
// 차례 · 안 씀 · 숨김은 정의대로(48-3 · `_Structures_Define`).
// 명세 종류(52-10)는 명세 키 · 명세가 뺀 옛 키를 칸으로 안 그림 — 명세 폼이 옵션 칸 아래에 그림
const owned = specOwnedKeys(type);
const shown =
type && !ctx.facilityFormKind(type)
? orderedOptions(type).filter((o) => ctx.includeDetail || isB05Option(o))
? orderedOptions(type).filter(
(o) => (ctx.includeDetail || isB05Option(o)) && !owned.has(o.key),
)
: [];
paintStructureSpec(optionRow, type, values);
optionRow.style.gridTemplateColumns = "";
if (!type || !shown.length) {
optionRow.hidden = true;
@@ -0,0 +1,88 @@
/* =============================================================================
* B05_Profile_UI_Structures_Spec.ts
* 일반 구조물(structures.json) 명세 컨테이너 폼(PLAN 52-10) — 계곡 통과 시설 밖 종류가 명세
* (`STRUCTURE_SPECS`)를 가지면 옵션 칸 아래에 같은 공용 폼(`design_structure_form`)을 그림.
*
* · 폼은 옵션 칸(`optionRow`) 짝으로 하나 — 조립기가 세워 걸고, 옵션 그리기 · 저장이 꺼내 씀
* · 명세 키 · 명세가 뺀 옛 키(retired)는 정의 옵션 칸으로 그리지 않음(옛 값은 병합이 지킴)
* · 잠금은 옵션 칸을 따름(측점 확정 전 흐림 · 조작 막음)
* ========================================================================== */
import type { StructureType } from "./B05_Profile_Api_Structures";
import {
createSpecForm,
type SpecForm,
type SpecLinks,
} from "../A00_Common/design/design_structure_form";
import { STRUCTURE_SPECS } from "../A00_Common/design/design_structure_pipe";
import { specKeys, type StructureSpec } from "../A00_Common/design/design_structure_spec";
const forms = new WeakMap<HTMLElement, SpecForm>();
/** 일반 구조물 명세 — 계곡 통과 시설(관 지점 정본)은 시설 폼 몫이라 뺌. */
export const structureSpecOf = (type: StructureType | null): StructureSpec | null =>
(type && !type.managed_by && STRUCTURE_SPECS[type.type_id]) || null;
/** 옵션 칸 짝 폼을 세움 — 값이 바뀌면 `onChange`(패널 즉시 반영). */
export function createStructureSpecForm(
optionRow: HTMLElement,
links: SpecLinks,
onChange: () => void,
): SpecForm {
const form = createSpecForm(links, { onChange });
form.root.hidden = true;
forms.set(optionRow, form);
const lock = (): void => {
const locked = optionRow.classList.contains("is-locked");
form.root.inert = locked;
form.root.classList.toggle("is-locked", locked);
};
if (typeof MutationObserver !== "undefined")
new MutationObserver(lock).observe(optionRow, {
attributes: true,
attributeFilter: ["class"],
});
return form;
}
/** 정의 옵션 칸으로 안 그리는 키 — 명세 키 · 명세가 뺀 옛 키. */
export function specOwnedKeys(type: StructureType | null): Set<string> {
const spec = structureSpecOf(type);
return new Set(spec ? [...specKeys(spec).keys, ...spec.retired] : []);
}
/** 종류 · 값으로 명세 폼을 다시 그림(명세 없는 종류면 가림). */
export function paintStructureSpec(
optionRow: HTMLElement,
type: StructureType | null,
values: Record<string, string | number>,
): void {
const form = forms.get(optionRow);
const spec = structureSpecOf(type);
if (!form) return;
form.root.hidden = !spec;
if (!spec) return;
const groups = Object.fromEntries((type?.groups ?? []).map((g) => [g.id, g.name]));
form.write(spec, values, type?.spec_names ?? {}, groups);
}
/** 명세 폼 값(저장 키 그대로) — 명세 없는 종류면 빈 묶음. */
export function readStructureSpec(
optionRow: HTMLElement,
type: StructureType | null,
): Record<string, string | number> {
const form = forms.get(optionRow);
return form && structureSpecOf(type) ? form.read() : {};
}
/** [수정] 병합에서 폼이 다시 쓰는 키 — 명세 키 + 옛 값 중 선택 컨테이너 머리 키(빼면 지워져야 함). */
export function specRenderedKeys(
type: StructureType | null,
previous: Record<string, string | number> | undefined,
): string[] {
const spec = structureSpecOf(type);
if (!spec) return [];
const { keys, prefixes } = specKeys(spec);
const own = Object.keys(previous ?? {}).filter((key) => prefixes.some((p) => key.startsWith(p)));
return [...keys, ...own];
}
@@ -190,6 +190,7 @@
/* 측점 미입력 상태의 상세 옵션 잠금 — 입력 순서 가이드(2026-08-18 사용자 지시).
조작 차단은 disabled·inert가 맡고 여기서는 흐림만 그린다. */
.b05-structure__grid.is-locked,
.b05-structure__spec.is-locked,
.b05-drainage__facility.is-locked {
opacity: 0.5;
}