@chahidy/plannr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/dist/index.cjs +104 -0
- package/dist/index.d.cts +233 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.js +77 -0
- package/main.js +14 -0
- package/package.json +73 -0
- package/src/api/build-plan-numbers.ts +54 -0
- package/src/domain/block-config.ts +84 -0
- package/src/domain/build-plan-numbers.ts +40 -0
- package/src/domain/floor.ts +63 -0
- package/src/domain/plan-number-parts.ts +35 -0
- package/src/domain/plan-number-type.ts +41 -0
- package/src/domain/plan-type.ts +7 -0
- package/src/domain/plan.ts +11 -0
- package/src/domain/trade.ts +18 -0
- package/src/generators/floors.ts +52 -0
- package/src/generators/plan-generator.ts +46 -0
- package/src/generators/plan-number.ts +33 -0
- package/src/index.ts +34 -0
- package/src/package.json +18 -0
- package/src/rules/plan-rule.ts +7 -0
- package/src/standards/default-tga.ts +9 -0
- package/src/standards/office-standard.ts +6 -0
- package/tsconfig.json +10 -0
- package/tsup.config.ts +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Plannr – Plannummer Generator für Baupläne
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/plannr-core)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Plannr ist ein TypeScript-Paket zur **automatischen Generierung von Plannummern** für Bauprojekte. Es unterstützt verschiedene **Bürostandards**, **mehrere Geschosse**, **Gewerke** und **Planarten**. Ideal für Web-Apps oder interne Tools.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Frei konfigurierbare Plannummern
|
|
13
|
+
- Unterstützung von Untergeschossen (UG), Obergeschossen (OG), Erdgeschoss (EG) und Dachgeschoss (DG)
|
|
14
|
+
- Mehrere Gewerke gleichzeitig auswählbar (Lüftung, Heizung, Sanitär …)
|
|
15
|
+
- Dynamische Template Literal Typen für Plannummern
|
|
16
|
+
- Unterstützung von Grundrissen und Strangschemata
|
|
17
|
+
- Vollständig typisiert in TypeScript
|
|
18
|
+
- Einfache Integration in Webanwendungen
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install plannr-core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
oder mit Yarn:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn add plannr-core
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Nutzung
|
|
37
|
+
|
|
38
|
+
### Import
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { buildPlanNumbers } from "plannr-core";
|
|
42
|
+
import { STANDARD_TGA } from "plannr-core/standards";
|
|
43
|
+
import type { FloorConfig } from "plannr-core/domain/floor";
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Beispiel: Pläne generieren
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
const floorsConfig: FloorConfig = {
|
|
50
|
+
ug: { count: 1, prefix: "UG" },
|
|
51
|
+
og: { count: 3, prefix: "OG" },
|
|
52
|
+
eg: { prefix: "EG" },
|
|
53
|
+
dg: { prefix: "DG" }
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const planNumbers = buildPlanNumbers({
|
|
57
|
+
projectNumber: "21015",
|
|
58
|
+
counts: floorsConfig,
|
|
59
|
+
blocks: [
|
|
60
|
+
{ trades: ["LUE"], planTypes: ["GR"], perFloor: true },
|
|
61
|
+
{ trades: ["HEI"], planTypes: ["SC"], minimumPerTrade: 2 }
|
|
62
|
+
],
|
|
63
|
+
standard: STANDARD_TGA
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
console.log(planNumbers);
|
|
67
|
+
// [
|
|
68
|
+
// "21015-LUE-GR-UG1-001-F-a",
|
|
69
|
+
// "21015-LUE-GR-EG-002-F-a",
|
|
70
|
+
// "21015-LUE-GR-OG1-003-F-a",
|
|
71
|
+
// ...
|
|
72
|
+
// ]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## API
|
|
78
|
+
|
|
79
|
+
### `buildPlanNumbers(input: BuildPlanNumbersInput): string[]`
|
|
80
|
+
|
|
81
|
+
Generiert Plannummern basierend auf:
|
|
82
|
+
|
|
83
|
+
- `projectNumber: string` – Projekt
|
|
84
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
buildPlanNumbers: () => buildPlanNumbers
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/generators/floors.ts
|
|
28
|
+
function generateFloors(counts, cfg) {
|
|
29
|
+
const floors = [];
|
|
30
|
+
const ugCount = counts?.ug?.count ?? 0;
|
|
31
|
+
const ugPrefix = cfg?.ug?.prefix ?? counts?.ug?.prefix ?? "UG";
|
|
32
|
+
for (let i = ugCount; i >= 1; i--) {
|
|
33
|
+
floors.push(`${ugPrefix}${i}`);
|
|
34
|
+
}
|
|
35
|
+
const egName = cfg?.eg?.prefix ?? "EG";
|
|
36
|
+
floors.push(egName);
|
|
37
|
+
const ogCount = counts?.og?.count ?? 0;
|
|
38
|
+
const ogPrefix = cfg?.og?.prefix ?? counts?.og?.prefix ?? "OG";
|
|
39
|
+
for (let i = 1; i <= ogCount; i++) {
|
|
40
|
+
floors.push(`${ogPrefix}${i}`);
|
|
41
|
+
}
|
|
42
|
+
if (counts?.dg) {
|
|
43
|
+
const dgName = cfg?.dg?.prefix ?? "DG";
|
|
44
|
+
floors.push(dgName);
|
|
45
|
+
}
|
|
46
|
+
return floors;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/generators/plan-number.ts
|
|
50
|
+
function buildPlanNumber(plan, projectNumber, separator = "_", suffix, index) {
|
|
51
|
+
const floor = plan.floor ?? "XX";
|
|
52
|
+
const trade = plan.trade ?? "AR";
|
|
53
|
+
const running = String(plan.runningNumber).padStart(3, "0");
|
|
54
|
+
return `${projectNumber}${separator}${trade}${separator}${plan.type}${separator}${floor}${separator}${running}${separator}${suffix}${separator}${index}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/api/build-plan-numbers.ts
|
|
58
|
+
function buildPlanNumbers(input) {
|
|
59
|
+
let runningNumber = 1;
|
|
60
|
+
const plans = [];
|
|
61
|
+
for (const block of input.blocks) {
|
|
62
|
+
const floors = generateFloors(input.floorcfg);
|
|
63
|
+
for (const trade of block.trades) {
|
|
64
|
+
for (const type of block.planTypes) {
|
|
65
|
+
if (type === "GR") {
|
|
66
|
+
const perFloor = block.plansPerFloor ?? 1;
|
|
67
|
+
for (const floor of floors) {
|
|
68
|
+
for (let i = 0; i < perFloor; i++) {
|
|
69
|
+
plans.push({
|
|
70
|
+
trade,
|
|
71
|
+
type,
|
|
72
|
+
floor,
|
|
73
|
+
runningNumber: runningNumber++
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else if (type === "SC") {
|
|
78
|
+
const count = block.minimumPerTrade ?? 1;
|
|
79
|
+
for (let i = 0; i < count; i++) {
|
|
80
|
+
plans.push({
|
|
81
|
+
trade,
|
|
82
|
+
type,
|
|
83
|
+
floor: void 0,
|
|
84
|
+
runningNumber: runningNumber++
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return plans.map(
|
|
92
|
+
(plan) => buildPlanNumber(
|
|
93
|
+
plan,
|
|
94
|
+
input.projectNumber,
|
|
95
|
+
input.separator ?? "-",
|
|
96
|
+
input.suffix ?? "F",
|
|
97
|
+
input.index ?? "A"
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
buildPlanNumbers
|
|
104
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Technische Gewerke (TGA).
|
|
3
|
+
*
|
|
4
|
+
* LUE - Lüftung
|
|
5
|
+
*
|
|
6
|
+
* HZ - Heizung
|
|
7
|
+
*
|
|
8
|
+
* SAN - Sanitär
|
|
9
|
+
*
|
|
10
|
+
* EL - Elektro
|
|
11
|
+
*
|
|
12
|
+
* TR - Tragwerk
|
|
13
|
+
*
|
|
14
|
+
* AR - Architektur
|
|
15
|
+
*
|
|
16
|
+
* HLS - Heizung/Lüftung/Sanitär
|
|
17
|
+
*/
|
|
18
|
+
type Trade = "LUE" | "HZ" | "SAN" | "EL" | "TR" | "AR" | "HLS";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Planarten im TGA-Bereich.
|
|
22
|
+
*
|
|
23
|
+
* - `GR` = Grundriss
|
|
24
|
+
* - `SC` = Schema / Strangschema
|
|
25
|
+
*/
|
|
26
|
+
type PlanType = "GR" | "SC" | "DT";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Konfiguriert einen zusammenhängenden Block von Plänen,
|
|
30
|
+
* der in definierter Reihenfolge generiert wird.
|
|
31
|
+
*
|
|
32
|
+
* Die Reihenfolge der Blocks bestimmt die Reihenfolge
|
|
33
|
+
* der erzeugten Plannummern.
|
|
34
|
+
*/
|
|
35
|
+
interface PlanBlockConfig {
|
|
36
|
+
/**
|
|
37
|
+
* Gewerke, für die dieser Block gilt.
|
|
38
|
+
*
|
|
39
|
+
* Für jedes Gewerk wird die Block-Logik separat angewendet.
|
|
40
|
+
*
|
|
41
|
+
* @example ["LUE", "HEI", "SAN"]
|
|
42
|
+
*/
|
|
43
|
+
trades: Trade[];
|
|
44
|
+
/**
|
|
45
|
+
* Planarten, die in diesem Block erzeugt werden.
|
|
46
|
+
*
|
|
47
|
+
* - `GR` = Grundriss
|
|
48
|
+
* - `SC` = Schema / Strangschema
|
|
49
|
+
*
|
|
50
|
+
* @example ["GR"]
|
|
51
|
+
*/
|
|
52
|
+
planTypes: PlanType[];
|
|
53
|
+
/**
|
|
54
|
+
* Gibt an, ob die Pläne geschossbezogen erzeugt werden.
|
|
55
|
+
*
|
|
56
|
+
* - Relevant für Grundrisse (`GR`)
|
|
57
|
+
* - Wird ignoriert bei Schemata (`SC`)
|
|
58
|
+
*
|
|
59
|
+
* @default true bei GR, false bei SC
|
|
60
|
+
*
|
|
61
|
+
* ⚠️ Empfehlung:
|
|
62
|
+
* In der Regel nicht manuell setzen,
|
|
63
|
+
* sondern über `planTypes` steuern.
|
|
64
|
+
*
|
|
65
|
+
* * @deprecated Wird implizit über `plansPerFloor` gesteuert.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
perFloor?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Anzahl der Grundrisspläne pro Geschoss und Gewerk.
|
|
71
|
+
*
|
|
72
|
+
* - Standard: 1
|
|
73
|
+
* - Beispiel: 2 → zwei Grundrisse pro Geschoss
|
|
74
|
+
*
|
|
75
|
+
* Wird **nur angewendet**, wenn `planTypes` `GR` enthält.
|
|
76
|
+
*
|
|
77
|
+
* @example 1
|
|
78
|
+
*/
|
|
79
|
+
plansPerFloor?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Minimale Anzahl von Plänen pro Gewerk.
|
|
82
|
+
*
|
|
83
|
+
* - Standard: 1
|
|
84
|
+
* - Typischer Anwendungsfall: Strangschemata (`SC`)
|
|
85
|
+
*
|
|
86
|
+
* Wird **nur angewendet**, wenn `planTypes` `SC` enthält.
|
|
87
|
+
*
|
|
88
|
+
* @example 3
|
|
89
|
+
*/
|
|
90
|
+
minimumPerTrade?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Optionale Reihenfolge der Geschosse für diesen Block.
|
|
93
|
+
*
|
|
94
|
+
* Ermöglicht z. B.:
|
|
95
|
+
* - erst EG, dann OGs
|
|
96
|
+
* - Sonderreihenfolgen für bestimmte Planarten
|
|
97
|
+
*
|
|
98
|
+
* Enthält nur Geschossnamen, die in `FloorConfig` existieren.
|
|
99
|
+
*
|
|
100
|
+
* @example ["EG", "1OG", "2OG"]
|
|
101
|
+
*/
|
|
102
|
+
floorOrder?: string[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Basis-Floors (feste Namen)
|
|
107
|
+
*/
|
|
108
|
+
type BaseFloor = "UG" | "EG" | "1OG" | "2OG" | "3OG" | "DG";
|
|
109
|
+
/**
|
|
110
|
+
* Floor mit optionalem Index/Suffix
|
|
111
|
+
* - z.B. UG1, OG2, EG1, DG1
|
|
112
|
+
*/
|
|
113
|
+
type Floor<I extends string = `${number}`> = BaseFloor | `${BaseFloor}${I}`;
|
|
114
|
+
/**
|
|
115
|
+
* Konfiguration der Geschossbezeichnungen.
|
|
116
|
+
*
|
|
117
|
+
* Ermöglicht unterschiedliche Bürostandards:
|
|
118
|
+
* - UG vs. -01
|
|
119
|
+
* - OG1 vs. 1OG
|
|
120
|
+
* - optionales Dachgeschoss
|
|
121
|
+
*/
|
|
122
|
+
interface FloorConfig {
|
|
123
|
+
/**
|
|
124
|
+
* Untergeschoss-Bezeichnung (z. B. "UG" oder "-01").
|
|
125
|
+
*/
|
|
126
|
+
ug?: {
|
|
127
|
+
prefix?: Floor;
|
|
128
|
+
count: number;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Erdgeschoss-Bezeichnung (z. B. "EG").
|
|
132
|
+
*/
|
|
133
|
+
eg?: {
|
|
134
|
+
prefix?: Floor;
|
|
135
|
+
count: number;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Präfix für Obergeschosse.
|
|
139
|
+
*
|
|
140
|
+
* Beispiel:
|
|
141
|
+
* - Prefix: "OG"
|
|
142
|
+
* - Ergebnis: OG1, OG2, OG3, ...
|
|
143
|
+
*/
|
|
144
|
+
og?: {
|
|
145
|
+
prefix?: Floor;
|
|
146
|
+
count: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Dachgeschoss-Bezeichnung (z. B. "DG").
|
|
150
|
+
*/
|
|
151
|
+
dg?: {
|
|
152
|
+
prefix?: Floor;
|
|
153
|
+
count: number;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Erzeugt Plannummern auf Basis von Blöcken, Geschossen und Projektparametern.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* buildPlanNumbers({
|
|
163
|
+
* projectNumber: "21015",
|
|
164
|
+
* floorcfg: { eg: "EG", ogPrefix: "OG" },
|
|
165
|
+
* blocks: [
|
|
166
|
+
* { trades: ["LUE"], planTypes: ["GR"], plansPerFloor: 1 },
|
|
167
|
+
* { trades: ["HEI"], planTypes: ["SC"], minimumPerTrade: 2 }
|
|
168
|
+
* ]
|
|
169
|
+
* })
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
interface BuildPlanNumbersInput {
|
|
173
|
+
/**
|
|
174
|
+
* Vereinfachte Angabe:
|
|
175
|
+
* Gesamtanzahl Geschosse (inkl. EG).
|
|
176
|
+
*
|
|
177
|
+
* ⚠️ Wird ignoriert, wenn `floorCounts` gesetzt ist.
|
|
178
|
+
*/
|
|
179
|
+
floors?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Erweiterte Geschossdefinition.
|
|
182
|
+
*
|
|
183
|
+
* Überschreibt die automatische Geschossermittlung.
|
|
184
|
+
*/
|
|
185
|
+
floorCounts?: FloorConfig;
|
|
186
|
+
floorcfg?: FloorConfig;
|
|
187
|
+
blocks: PlanBlockConfig[];
|
|
188
|
+
projectNumber: string;
|
|
189
|
+
separator?: string;
|
|
190
|
+
suffix?: string;
|
|
191
|
+
index?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare function buildPlanNumbers(input: BuildPlanNumbersInput): string[];
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Projektnummer (z. B. "21015")
|
|
198
|
+
*/
|
|
199
|
+
type ProjectNumber = string;
|
|
200
|
+
/**
|
|
201
|
+
* Laufende Plannummer innerhalb eines Projekts
|
|
202
|
+
* (z. B. "001", "002", ...)
|
|
203
|
+
*/
|
|
204
|
+
type RunningNumber = string;
|
|
205
|
+
/**
|
|
206
|
+
* Planstatus / Freigabestatus
|
|
207
|
+
* (z. B. "F", "A", "P")
|
|
208
|
+
*/
|
|
209
|
+
type PlanStatus = string;
|
|
210
|
+
/**
|
|
211
|
+
* Index / Revisionskennzeichen
|
|
212
|
+
* (z. B. "a", "b", "c")
|
|
213
|
+
*/
|
|
214
|
+
type PlanIndex = string;
|
|
215
|
+
/**
|
|
216
|
+
* Trennzeichen zwischen Plannummernblöcken
|
|
217
|
+
* (z. B. "-", "_")
|
|
218
|
+
*/
|
|
219
|
+
type Separator = string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Template Literal Type für eine Plannummer.
|
|
223
|
+
*
|
|
224
|
+
* Aufbau:
|
|
225
|
+
* Projekt → Gewerk → Planart → Geschoss → laufende Nummer → Status → Index
|
|
226
|
+
*/
|
|
227
|
+
type Plannummer<Sep extends Separator, PN extends ProjectNumber, G extends Trade, T extends PlanType, F extends Floor, N extends RunningNumber, S extends PlanStatus, I extends PlanIndex> = `${PN}${Sep}${G}${Sep}${T}${Sep}${F}${Sep}${N}${Sep}${S}${Sep}${I}`;
|
|
228
|
+
/**
|
|
229
|
+
* Standard-Plannummer, wie sie von der API zurückgegeben wird.
|
|
230
|
+
*/
|
|
231
|
+
type DefaultPlannummer = Plannummer<"-", ProjectNumber, Trade, PlanType, Floor, RunningNumber, PlanStatus, PlanIndex>;
|
|
232
|
+
|
|
233
|
+
export { type BuildPlanNumbersInput, type DefaultPlannummer, type FloorConfig, type PlanBlockConfig, type PlanType, type Trade, buildPlanNumbers };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Technische Gewerke (TGA).
|
|
3
|
+
*
|
|
4
|
+
* LUE - Lüftung
|
|
5
|
+
*
|
|
6
|
+
* HZ - Heizung
|
|
7
|
+
*
|
|
8
|
+
* SAN - Sanitär
|
|
9
|
+
*
|
|
10
|
+
* EL - Elektro
|
|
11
|
+
*
|
|
12
|
+
* TR - Tragwerk
|
|
13
|
+
*
|
|
14
|
+
* AR - Architektur
|
|
15
|
+
*
|
|
16
|
+
* HLS - Heizung/Lüftung/Sanitär
|
|
17
|
+
*/
|
|
18
|
+
type Trade = "LUE" | "HZ" | "SAN" | "EL" | "TR" | "AR" | "HLS";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Planarten im TGA-Bereich.
|
|
22
|
+
*
|
|
23
|
+
* - `GR` = Grundriss
|
|
24
|
+
* - `SC` = Schema / Strangschema
|
|
25
|
+
*/
|
|
26
|
+
type PlanType = "GR" | "SC" | "DT";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Konfiguriert einen zusammenhängenden Block von Plänen,
|
|
30
|
+
* der in definierter Reihenfolge generiert wird.
|
|
31
|
+
*
|
|
32
|
+
* Die Reihenfolge der Blocks bestimmt die Reihenfolge
|
|
33
|
+
* der erzeugten Plannummern.
|
|
34
|
+
*/
|
|
35
|
+
interface PlanBlockConfig {
|
|
36
|
+
/**
|
|
37
|
+
* Gewerke, für die dieser Block gilt.
|
|
38
|
+
*
|
|
39
|
+
* Für jedes Gewerk wird die Block-Logik separat angewendet.
|
|
40
|
+
*
|
|
41
|
+
* @example ["LUE", "HEI", "SAN"]
|
|
42
|
+
*/
|
|
43
|
+
trades: Trade[];
|
|
44
|
+
/**
|
|
45
|
+
* Planarten, die in diesem Block erzeugt werden.
|
|
46
|
+
*
|
|
47
|
+
* - `GR` = Grundriss
|
|
48
|
+
* - `SC` = Schema / Strangschema
|
|
49
|
+
*
|
|
50
|
+
* @example ["GR"]
|
|
51
|
+
*/
|
|
52
|
+
planTypes: PlanType[];
|
|
53
|
+
/**
|
|
54
|
+
* Gibt an, ob die Pläne geschossbezogen erzeugt werden.
|
|
55
|
+
*
|
|
56
|
+
* - Relevant für Grundrisse (`GR`)
|
|
57
|
+
* - Wird ignoriert bei Schemata (`SC`)
|
|
58
|
+
*
|
|
59
|
+
* @default true bei GR, false bei SC
|
|
60
|
+
*
|
|
61
|
+
* ⚠️ Empfehlung:
|
|
62
|
+
* In der Regel nicht manuell setzen,
|
|
63
|
+
* sondern über `planTypes` steuern.
|
|
64
|
+
*
|
|
65
|
+
* * @deprecated Wird implizit über `plansPerFloor` gesteuert.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
perFloor?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Anzahl der Grundrisspläne pro Geschoss und Gewerk.
|
|
71
|
+
*
|
|
72
|
+
* - Standard: 1
|
|
73
|
+
* - Beispiel: 2 → zwei Grundrisse pro Geschoss
|
|
74
|
+
*
|
|
75
|
+
* Wird **nur angewendet**, wenn `planTypes` `GR` enthält.
|
|
76
|
+
*
|
|
77
|
+
* @example 1
|
|
78
|
+
*/
|
|
79
|
+
plansPerFloor?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Minimale Anzahl von Plänen pro Gewerk.
|
|
82
|
+
*
|
|
83
|
+
* - Standard: 1
|
|
84
|
+
* - Typischer Anwendungsfall: Strangschemata (`SC`)
|
|
85
|
+
*
|
|
86
|
+
* Wird **nur angewendet**, wenn `planTypes` `SC` enthält.
|
|
87
|
+
*
|
|
88
|
+
* @example 3
|
|
89
|
+
*/
|
|
90
|
+
minimumPerTrade?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Optionale Reihenfolge der Geschosse für diesen Block.
|
|
93
|
+
*
|
|
94
|
+
* Ermöglicht z. B.:
|
|
95
|
+
* - erst EG, dann OGs
|
|
96
|
+
* - Sonderreihenfolgen für bestimmte Planarten
|
|
97
|
+
*
|
|
98
|
+
* Enthält nur Geschossnamen, die in `FloorConfig` existieren.
|
|
99
|
+
*
|
|
100
|
+
* @example ["EG", "1OG", "2OG"]
|
|
101
|
+
*/
|
|
102
|
+
floorOrder?: string[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Basis-Floors (feste Namen)
|
|
107
|
+
*/
|
|
108
|
+
type BaseFloor = "UG" | "EG" | "1OG" | "2OG" | "3OG" | "DG";
|
|
109
|
+
/**
|
|
110
|
+
* Floor mit optionalem Index/Suffix
|
|
111
|
+
* - z.B. UG1, OG2, EG1, DG1
|
|
112
|
+
*/
|
|
113
|
+
type Floor<I extends string = `${number}`> = BaseFloor | `${BaseFloor}${I}`;
|
|
114
|
+
/**
|
|
115
|
+
* Konfiguration der Geschossbezeichnungen.
|
|
116
|
+
*
|
|
117
|
+
* Ermöglicht unterschiedliche Bürostandards:
|
|
118
|
+
* - UG vs. -01
|
|
119
|
+
* - OG1 vs. 1OG
|
|
120
|
+
* - optionales Dachgeschoss
|
|
121
|
+
*/
|
|
122
|
+
interface FloorConfig {
|
|
123
|
+
/**
|
|
124
|
+
* Untergeschoss-Bezeichnung (z. B. "UG" oder "-01").
|
|
125
|
+
*/
|
|
126
|
+
ug?: {
|
|
127
|
+
prefix?: Floor;
|
|
128
|
+
count: number;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Erdgeschoss-Bezeichnung (z. B. "EG").
|
|
132
|
+
*/
|
|
133
|
+
eg?: {
|
|
134
|
+
prefix?: Floor;
|
|
135
|
+
count: number;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Präfix für Obergeschosse.
|
|
139
|
+
*
|
|
140
|
+
* Beispiel:
|
|
141
|
+
* - Prefix: "OG"
|
|
142
|
+
* - Ergebnis: OG1, OG2, OG3, ...
|
|
143
|
+
*/
|
|
144
|
+
og?: {
|
|
145
|
+
prefix?: Floor;
|
|
146
|
+
count: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Dachgeschoss-Bezeichnung (z. B. "DG").
|
|
150
|
+
*/
|
|
151
|
+
dg?: {
|
|
152
|
+
prefix?: Floor;
|
|
153
|
+
count: number;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Erzeugt Plannummern auf Basis von Blöcken, Geschossen und Projektparametern.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* buildPlanNumbers({
|
|
163
|
+
* projectNumber: "21015",
|
|
164
|
+
* floorcfg: { eg: "EG", ogPrefix: "OG" },
|
|
165
|
+
* blocks: [
|
|
166
|
+
* { trades: ["LUE"], planTypes: ["GR"], plansPerFloor: 1 },
|
|
167
|
+
* { trades: ["HEI"], planTypes: ["SC"], minimumPerTrade: 2 }
|
|
168
|
+
* ]
|
|
169
|
+
* })
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
interface BuildPlanNumbersInput {
|
|
173
|
+
/**
|
|
174
|
+
* Vereinfachte Angabe:
|
|
175
|
+
* Gesamtanzahl Geschosse (inkl. EG).
|
|
176
|
+
*
|
|
177
|
+
* ⚠️ Wird ignoriert, wenn `floorCounts` gesetzt ist.
|
|
178
|
+
*/
|
|
179
|
+
floors?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Erweiterte Geschossdefinition.
|
|
182
|
+
*
|
|
183
|
+
* Überschreibt die automatische Geschossermittlung.
|
|
184
|
+
*/
|
|
185
|
+
floorCounts?: FloorConfig;
|
|
186
|
+
floorcfg?: FloorConfig;
|
|
187
|
+
blocks: PlanBlockConfig[];
|
|
188
|
+
projectNumber: string;
|
|
189
|
+
separator?: string;
|
|
190
|
+
suffix?: string;
|
|
191
|
+
index?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare function buildPlanNumbers(input: BuildPlanNumbersInput): string[];
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Projektnummer (z. B. "21015")
|
|
198
|
+
*/
|
|
199
|
+
type ProjectNumber = string;
|
|
200
|
+
/**
|
|
201
|
+
* Laufende Plannummer innerhalb eines Projekts
|
|
202
|
+
* (z. B. "001", "002", ...)
|
|
203
|
+
*/
|
|
204
|
+
type RunningNumber = string;
|
|
205
|
+
/**
|
|
206
|
+
* Planstatus / Freigabestatus
|
|
207
|
+
* (z. B. "F", "A", "P")
|
|
208
|
+
*/
|
|
209
|
+
type PlanStatus = string;
|
|
210
|
+
/**
|
|
211
|
+
* Index / Revisionskennzeichen
|
|
212
|
+
* (z. B. "a", "b", "c")
|
|
213
|
+
*/
|
|
214
|
+
type PlanIndex = string;
|
|
215
|
+
/**
|
|
216
|
+
* Trennzeichen zwischen Plannummernblöcken
|
|
217
|
+
* (z. B. "-", "_")
|
|
218
|
+
*/
|
|
219
|
+
type Separator = string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Template Literal Type für eine Plannummer.
|
|
223
|
+
*
|
|
224
|
+
* Aufbau:
|
|
225
|
+
* Projekt → Gewerk → Planart → Geschoss → laufende Nummer → Status → Index
|
|
226
|
+
*/
|
|
227
|
+
type Plannummer<Sep extends Separator, PN extends ProjectNumber, G extends Trade, T extends PlanType, F extends Floor, N extends RunningNumber, S extends PlanStatus, I extends PlanIndex> = `${PN}${Sep}${G}${Sep}${T}${Sep}${F}${Sep}${N}${Sep}${S}${Sep}${I}`;
|
|
228
|
+
/**
|
|
229
|
+
* Standard-Plannummer, wie sie von der API zurückgegeben wird.
|
|
230
|
+
*/
|
|
231
|
+
type DefaultPlannummer = Plannummer<"-", ProjectNumber, Trade, PlanType, Floor, RunningNumber, PlanStatus, PlanIndex>;
|
|
232
|
+
|
|
233
|
+
export { type BuildPlanNumbersInput, type DefaultPlannummer, type FloorConfig, type PlanBlockConfig, type PlanType, type Trade, buildPlanNumbers };
|