Files
Aislo/M02_MasterTemplete/StructOptions/M02_SO_Def_Spec.ts
T
eomsangdonandClaude Opus 5.5 3e5c64839a feat(design): 공용 틀 글 손 입력 항목 · 기타 선택 컨테이너 상세 내용 · 기타 이름 = 집계 건 이름(52-14)
- 명세 항목 꼴 「글」(kind text · 길이 상한 TEXT_MAX 100 · 비우기 · 이름 표 · M02 이름 나무 꼴 「글」)
- 다 빈 선택 인스턴스도 첫 칸을 빈 글로 남겨 자리 지킴 — 잇기 · 집계 줄 · 다시 열기
- 기타 = 선택 컨테이너 「상세 내용」(비고 글 · etc_detail_{n}_note · 잇기 getcdetail{n}) · 종류 단위 잇기 줄 가림 규칙 그대로
- 집계 모음: 기타 건 이름(그룹) = 상세 종류 이름 · 비면 「기타」 · 컨테이너 건 = 이름 + n · 서버 컨테이너 표에 기타 짝
- 시험: test_52_14_etc_text · 헬퍼 etc · ui_checks 52-10 에 기타 컨테이너 단계 · 52-1 스크립트는 보이는 명세 폼을 잡음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
2026-10-06 00:08:44 +09:00

69 lines
2.7 KiB
TypeScript

/* =============================================================================
* M02_SO_Def_Spec.ts
* 구조물 명세가 있는 종류(PLAN 52 · `STRUCTURE_SPECS`)의 이름 고치기 칸(52-11) — 나무 꼴
* 컨테이너 제목 › 항목 이름 › 값 이름 · 이름만 고침 · 키 · 필수/선택 · 꼴은 읽기만 ·
* 아래 미리보기 = B05 · B06 이 그리는 같은 명세 폼(`createSpecForm`)에 고친 이름을 얹음.
* 구조물군 · 종류 이름은 왼쪽 목록 · 머리 칸이 그대로 고침.
* ========================================================================== */
import { createTag, el } from "@ui/ui_template_elements";
import { createSpecForm } from "../../A00_Common/design/design_structure_form";
import type { StructureSpec } from "../../A00_Common/design/design_structure_spec";
import type { StructDef, TypeDef } from "./M02_SO_Def_Model";
import { setSpecName, specNameRows, type SpecNameRow } from "./M02_SO_Def_Spec_Model";
import { head, textBox } from "./M02_SO_Def_Ui";
import { to, type OptionsTextKey } from "./M02_SO_Text";
const TAG: Record<NonNullable<SpecNameRow["tag"]>, OptionsTextKey> = {
required: "SpecRequired",
optional: "SpecOptional",
select: "FormSelect",
number: "FormNumber",
text: "FormText",
auto: "FormAuto",
};
export function buildSpecBlock(opt: {
def: StructDef;
type: TypeDef;
spec: StructureSpec;
edit: boolean;
changed: () => void;
}): HTMLElement {
const { def, type, spec, edit, changed } = opt;
const rows = specNameRows(def, spec).map((row) =>
el("div", {
className: `m02-sod__specrow is-level-${row.level}`,
attrs: { "data-sod-spec": row.nameKey },
children: [
textBox(row.label, (v) => setSpecName(def, type.type_id, row, v), changed, {
edit,
attr: "data-sod-spec-name",
cls: "m02-sod__name",
}),
el("small", { className: "m02-opts__key", text: row.key }),
...(row.tag ? [createTag(to(TAG[row.tag]), "neutral")] : []),
],
}),
);
// 미리보기 — 값 없는 새 구조물 폼 · 잇기 줄 없음(조합은 프로젝트 몫)
const preview = createSpecForm(null);
const groups = Object.fromEntries((def.그룹[type.type_id] ?? []).map((g) => [g.id, g.이름]));
preview.write(spec, {}, def.종류[type.type_id]?.이름 ?? {}, groups);
preview.root.inert = true;
return el("div", {
className: "m02-sod__block",
attrs: { "data-sod-spec-block": "" },
children: [
...head(to("SpecHead"), to("SpecNote")),
...rows,
...head(to("SpecPreview")),
el("div", {
className: "m02-sod__specpreview",
attrs: { "data-sod-spec-preview": "" },
children: [preview.root],
}),
],
});
}