// Abschnitte für Bemassungs-Bezüge und Detail-Verweise der Attribute ([165] aus `ObjectInfoPanel.tsx`). // Gerufen von `AttributesPanel`. import type { DimRef } from "../../model/types"; import { usePanelHost } from "../host"; import { t } from "../../i18n"; import type { TranslationKey } from "../../i18n"; import type { DetailRefInfo } from "../../state/selectionInfo"; import { Dropdown } from "../../ui/Dropdown"; // ── Assoziative Bemassung ([38]) ──────────────────────────────────────────── // Je Punkt: frei, angehängt (Merkmal + Element) oder Bezug verloren; „Bemassung lösen" entfernt alle. export function DimRefsSection({ refs, drawingId, host, }: { refs: (DimRef | null)[]; drawingId: string; host: ReturnType; }) { const lost = refs.some((r) => r?.lost); return ( <>
{t("objinfo.dimRefs.section")}
{refs.map((r, i) => (
{t("objinfo.dimRefs.point", { n: i + 1 })} {!r ? t("objinfo.dimRefs.free") : r.lost ? t("objinfo.dimRefs.lost", { id: r.id }) : `${t(`objinfo.dimRefs.feature.${r.feature}` as TranslationKey)} · ${r.id}${r.id2 ? ` / ${r.id2}` : ""}`}
))} {lost &&
{t("objinfo.dimRefs.lostHint")}
}
); } // ── Masszahl ([172]) ───────────────────────────────────────────────────────── // Vorgabe: mittig über dem Massstrich; eine verschobene Zahl lässt sich dorthin zurücksetzen. export function DimTextSection({ drawingId, host }: { drawingId: string; host: ReturnType }) { return ( <>
); } // ── Detail-/Schnitt-Verweis-Attribut-Abschnitt ────────────────────────────── // Bezeichner (obere Zeile) + Blattverknüpfung (Dropdown der Project.layouts, // „kein Verweis" löst sie); ohne Verknüpfung zusätzlich ein manueller // Blattname-Platzhalter (untere Zeile, s. `DetailRefInfo`-Kommentar). export function DetailRefSection({ detailRef, drawingId, host, }: { detailRef: DetailRefInfo; drawingId: string; host: ReturnType; }) { return ( <>
{t("objinfo.detailRef.section")}
{t("objinfo.detailRef.label")} host.onSetDetailRefLabel(drawingId, e.target.value)} title={t("objinfo.detailRef.label")} />
{t("objinfo.detailRef.sheet")} host.onSetDetailRefSheetLayout(drawingId, v === "" ? undefined : v)} options={[ { value: "", label: t("objinfo.detailRef.sheet.none") }, ...detailRef.availableLayouts.map((l) => ({ value: l.id, label: l.name })), ]} title={t("objinfo.detailRef.sheet")} width={130} />
{!detailRef.sheetLayoutId && (
{t("objinfo.detailRef.sheetLabel")} host.onSetDetailRefSheetLabel(drawingId, e.target.value)} title={t("objinfo.detailRef.sheetLabel")} />
)} ); }