From 69fb8f23180f3be52035b6095503a7d7a5c2c2c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 18:23:38 +0000 Subject: [PATCH] =?UTF-8?q?[79]=20Publikationssatz:=20Reihenfolge=20der=20?= =?UTF-8?q?Bl=C3=A4tter=20mit=20=E2=86=91/=E2=86=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67 --- TODO.md | 2 +- src/i18n/de.ts | 2 ++ src/i18n/en.ts | 2 ++ src/panels/PublishSection.move.test.ts | 14 +++++++++++ src/panels/PublishSection.tsx | 33 +++++++++++++++++++++----- 5 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 src/panels/PublishSection.move.test.ts diff --git a/TODO.md b/TODO.md index 3d5f0a5d..04b50b42 100644 --- a/TODO.md +++ b/TODO.md @@ -1770,7 +1770,7 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]). (Index A→B→…→AA, 2→3; Plan, Ops), Ausführung `export/publishRun.ts` (PDF über `layoutPdf.buildPagesPdf`, DXF/DWG über den Papierbereich-Export; mehrere Dateien als ZIP), Hülle `state/publishActions.ts`, UI-Abschnitt „Publikation“ im Mappe-Reiter (`panels/PublishSection.tsx`: Sätze, Einstellungen, ein Klick, Protokoll). Publizieren = ein Undo-Schritt (Index + Protokoll). - Offen: Reihenfolge der Blätter im Satz per Ziehen (heute Projekt-Reihenfolge beim Anhaken), DXF/DWG enthält die Papierbereiche + 4.11.: Reihenfolge der Blätter im Satz mit ↑/↓ (gewählte Blätter oben in Ausgabe-Reihenfolge). Offen: DXF/DWG enthält die Papierbereiche der Satz-Blätter, aber Papier-/Massstab-Übersteuerung wirkt dort nur als Export-Massstab, Satz je Ordner, Protokoll als Export. Nicht in der Tauri-App getestet (Browser-Download-Pfad geprüft). - ✅ **[93] Zeichnen auf dem Layout-Blatt = Zeichnen im Grundriss.** (29.10., Wartungs-Feedback „soll sich genau diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 095353c7..f94842ff 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -3222,6 +3222,8 @@ export const de = { "publish.format.dxf": "DXF mit Layouts", "publish.format.dwg": "DWG mit Layouts", "publish.sheets": "Blätter", + "publish.moveUp": "Im Satz nach vorne", + "publish.moveDown": "Im Satz nach hinten", "publish.views": "Gespeicherte Ansichten", "publish.pattern": "Dateiname", "publish.pattern.hint": "Platzhalter: {Projektnummer} {Projekt} {Blattnummer} {Blattname} {Index} {Datum} {Satz}", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 3549efb5..991e92ab 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -3208,6 +3208,8 @@ export const en: Record = { "publish.format.dxf": "DXF with layouts", "publish.format.dwg": "DWG with layouts", "publish.sheets": "Sheets", + "publish.moveUp": "Move earlier in the set", + "publish.moveDown": "Move later in the set", "publish.views": "Saved views", "publish.pattern": "File name", "publish.pattern.hint": "Placeholders: {Projektnummer} {Projekt} {Blattnummer} {Blattname} {Index} {Datum} {Satz}", diff --git a/src/panels/PublishSection.move.test.ts b/src/panels/PublishSection.move.test.ts new file mode 100644 index 00000000..51ce3ca2 --- /dev/null +++ b/src/panels/PublishSection.move.test.ts @@ -0,0 +1,14 @@ +// [79] Reihenfolge der Blätter im Publikationssatz: ↑/↓ tauschen Nachbarn, am Rand nichts. +import { describe, expect, it } from "vitest"; +import { move } from "./PublishSection"; + +describe("move", () => { + it("tauscht mit dem Nachbarn", () => { + expect(move(["a", "b", "c"], 1, -1)).toEqual(["b", "a", "c"]); + expect(move(["a", "b", "c"], 1, 1)).toEqual(["a", "c", "b"]); + }); + it("am Rand unverändert", () => { + expect(move(["a", "b"], 0, -1)).toEqual(["a", "b"]); + expect(move(["a", "b"], 1, 1)).toEqual(["a", "b"]); + }); +}); diff --git a/src/panels/PublishSection.tsx b/src/panels/PublishSection.tsx index 4b5961d2..d27ffd78 100644 --- a/src/panels/PublishSection.tsx +++ b/src/panels/PublishSection.tsx @@ -16,6 +16,15 @@ function toggle(list: readonly string[], id: string, on: boolean): string[] { return on ? (list.includes(id) ? [...list] : [...list, id]) : list.filter((x) => x !== id); } +/** Eintrag `i` um `d` (±1) verschieben. */ +export function move(list: readonly string[], i: number, d: number): string[] { + const j = i + d; + if (i < 0 || j < 0 || i >= list.length || j >= list.length) return [...list]; + const out = [...list]; + [out[i], out[j]] = [out[j], out[i]]; + return out; +} + function SetEditor({ set }: { set: PublishSet }) { const host = usePanelHost(); const project = host.project; @@ -43,12 +52,24 @@ function SetEditor({ set }: { set: PublishSet }) {
{t("publish.sheets")}
{layouts.length === 0 &&
{t("layouts.tree.empty")}
} - {layouts.map((l) => ( - - ))} + {/* Gewählte Blätter in Satz-Reihenfolge (so werden sie ausgegeben, [79]), mit ↑/↓; darunter die übrigen. */} + {[...set.layoutIds.map((id) => layouts.find((l) => l.id === id)).filter((l) => !!l), ...layouts.filter((l) => !set.layoutIds.includes(l.id))].map((l) => { + const i = set.layoutIds.indexOf(l!.id); + return ( +
+ + {i >= 0 && ( + <> + + + + )} +
+ ); + })}
{pdf && snapshots.length > 0 && (