[260] Typ-Feld „Im Grundriss“ im Fenster-/Türeditor (Objekt), gemeinsame Optionen mit den Ressourcen
This commit is contained in:
7 files changed
+102
-20
No files matched your search
@@ -24,6 +24,20 @@ describe("Objekteinstellungen: Öffnung [195b]", () => {
|
||||
expect(html).not.toContain("imp-overlay");
|
||||
});
|
||||
|
||||
it("[260] Typ-Feld „Im Grundriss“ im Editor: Fenster und Tür, Wert aus dem Typ", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
for (const kind of ["window", "door"] as const) {
|
||||
const o = p.openings!.find((x) => x.kind === kind && x.typeId && !x.hostRoofId && !x.hostCeilingId)!;
|
||||
const key = kind === "window" ? "windowTypes" : "doorTypes";
|
||||
getState().loadProject({ ...p, [key]: p[key]!.map((ty) => (ty.id === o.typeId ? { ...ty, planMode: "geschnitten" } : ty)) });
|
||||
setState({ selection: { ...EMPTY_SELECTION, openings: [o.id] } });
|
||||
const html = render();
|
||||
const m = /<select[^>]*data-testid="oed-planMode"[^>]*>.*?<\/select>/s.exec(html);
|
||||
expect(m, kind).not.toBeNull();
|
||||
expect(m![0]).toMatch(/<option value="geschnitten" selected/);
|
||||
}
|
||||
});
|
||||
|
||||
it("zwei Öffnungen mit abweichender Breite: „gemischt“ am Breitenfeld", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
const [a, b] = p.openings!.filter((x) => !x.hostRoofId && !x.hostCeilingId);
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
import { useStore } from "../../state/appStore";
|
||||
import type { usePanelHost } from "../host";
|
||||
import { getDoorType, getWindowType, sashesOfWindowType, glazingPanesOf } from "../../model/types";
|
||||
import { planModeFromValue, planModeOptions } from "../../ui/planModeOptions";
|
||||
import { CorePreview, DoorFramePanel, FrameDetailPanel, RebatePanel, RevealPanel, ScopeSwitch } from "../../ui/OpeningDetailPanels";
|
||||
|
||||
/** P0-Kategorien der Sidebar, je nach Öffnungsart. */
|
||||
@@ -304,17 +305,20 @@ function SelField<V extends string>({
|
||||
value,
|
||||
options,
|
||||
onChange,
|
||||
testId,
|
||||
}: {
|
||||
label: string;
|
||||
value: V;
|
||||
options: { value: V; label: string }[];
|
||||
onChange: (v: V) => void;
|
||||
testId?: string;
|
||||
}) {
|
||||
return (
|
||||
<label className="oed-field">
|
||||
<span className="oed-flabel">{label}</span>
|
||||
<select
|
||||
className="oed-select"
|
||||
data-testid={testId}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value as V)}
|
||||
>
|
||||
@@ -361,12 +365,22 @@ function BasisPanel({
|
||||
}) {
|
||||
if (isDoor && dt) {
|
||||
return (
|
||||
<SelField
|
||||
label={t("oed.f.kind")}
|
||||
value={dt.kind}
|
||||
options={DOOR_KIND_OPTS()}
|
||||
onChange={(v) => patchDt({ kind: v })}
|
||||
/>
|
||||
<>
|
||||
<SelField
|
||||
label={t("oed.f.kind")}
|
||||
value={dt.kind}
|
||||
options={DOOR_KIND_OPTS()}
|
||||
onChange={(v) => patchDt({ kind: v })}
|
||||
/>
|
||||
{/* [260] Darstellung im Grundriss (Typ; leer = Modelldarstellung), wie in den Ressourcen. */}
|
||||
<SelField
|
||||
label={t("objinfo.opening.planMode")}
|
||||
value={dt.planMode ?? ""}
|
||||
options={planModeOptions()}
|
||||
onChange={(v) => patchDt({ planMode: planModeFromValue(v) })}
|
||||
testId="oed-planMode"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (wt) {
|
||||
@@ -378,6 +392,14 @@ function BasisPanel({
|
||||
options={OPENING_KIND_OPTS()}
|
||||
onChange={(v) => patchWt({ kind: v })}
|
||||
/>
|
||||
{/* [260] Darstellung im Grundriss (Typ; leer = Modelldarstellung), wie in den Ressourcen. */}
|
||||
<SelField
|
||||
label={t("objinfo.opening.planMode")}
|
||||
value={wt.planMode ?? ""}
|
||||
options={planModeOptions()}
|
||||
onChange={(v) => patchWt({ planMode: planModeFromValue(v) })}
|
||||
testId="oed-planMode"
|
||||
/>
|
||||
<SelField
|
||||
label={t("oed.f.glazing")}
|
||||
value={String(glazingPanesOf(wt)) as "1" | "2" | "3"}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// [260] Auswahl „Im Grundriss“ für Fenster-/Türtypen: gemeinsam für die Ressourcen (Typ-Tabs) und den
|
||||
// Fenster-/Türeditor im Bereich „Objekt“ (eine Quelle für Werte und Texte).
|
||||
|
||||
import { t } from "../i18n";
|
||||
|
||||
export type OpeningPlanMode = "symbolisch" | "geschnitten";
|
||||
|
||||
/** Leer = wie Modelldarstellung (Vorgabe der Ansicht). */
|
||||
export function planModeOptions(): { value: "" | OpeningPlanMode; label: string }[] {
|
||||
return [
|
||||
{ value: "", label: t("objinfo.opening.planMode.fromModelView") },
|
||||
{ value: "symbolisch", label: t("objinfo.opening.planMode.symbolisch") },
|
||||
{ value: "geschnitten", label: t("objinfo.opening.planMode.geschnitten") },
|
||||
];
|
||||
}
|
||||
|
||||
export const planModeFromValue = (v: string): OpeningPlanMode | undefined => (v === "" ? undefined : (v as OpeningPlanMode));
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import type { DoorType, Opening, Project } from "../../model/types";
|
||||
import { t } from "../../i18n";
|
||||
import { planModeFromValue, planModeOptions } from "../planModeOptions";
|
||||
import { FieldRow, NumberField, Segmented, SelectField } from "./fields";
|
||||
import { INSET_FACE_OPTIONS, TypeLibraryTab } from "./TypeLibraryTab";
|
||||
import { ElevationPreview } from "../ElevationPreview";
|
||||
@@ -187,12 +188,8 @@ export function DoorStylesTab({
|
||||
<FieldRow label={t("objinfo.opening.planMode")}>
|
||||
<SelectField
|
||||
value={door.planMode ?? ""}
|
||||
onChange={(v) => patch({ planMode: v === "" ? undefined : (v as "symbolisch" | "geschnitten") })}
|
||||
options={[
|
||||
{ value: "", label: t("objinfo.opening.planMode.fromModelView") },
|
||||
{ value: "symbolisch", label: t("objinfo.opening.planMode.symbolisch") },
|
||||
{ value: "geschnitten", label: t("objinfo.opening.planMode.geschnitten") },
|
||||
]}
|
||||
onChange={(v) => patch({ planMode: planModeFromValue(v) })}
|
||||
options={planModeOptions()}
|
||||
/>
|
||||
</FieldRow>
|
||||
<FieldRow label={t("resources.field.transomHeight")}>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import type { Opening, Project, WindowType } from "../../model/types";
|
||||
import { t } from "../../i18n";
|
||||
import { planModeFromValue, planModeOptions } from "../planModeOptions";
|
||||
import { FieldRow, NumberField, SelectField } from "./fields";
|
||||
import { INSET_FACE_OPTIONS, TypeLibraryTab } from "./TypeLibraryTab";
|
||||
import { ElevationPreview } from "../ElevationPreview";
|
||||
@@ -207,12 +208,8 @@ export function WindowStylesTab({
|
||||
<FieldRow label={t("objinfo.opening.planMode")}>
|
||||
<SelectField
|
||||
value={win.planMode ?? ""}
|
||||
onChange={(v) => patch({ planMode: v === "" ? undefined : (v as "symbolisch" | "geschnitten") })}
|
||||
options={[
|
||||
{ value: "", label: t("objinfo.opening.planMode.fromModelView") },
|
||||
{ value: "symbolisch", label: t("objinfo.opening.planMode.symbolisch") },
|
||||
{ value: "geschnitten", label: t("objinfo.opening.planMode.geschnitten") },
|
||||
]}
|
||||
onChange={(v) => patch({ planMode: planModeFromValue(v) })}
|
||||
options={planModeOptions()}
|
||||
/>
|
||||
</FieldRow>
|
||||
<FieldRow label={t("objinfo.opening.planSwingArcs")}>
|
||||
|
||||
Reference in new issue
Block a user