@conuti-das/prince-ui-bo4e 0.3.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/LICENSE +21 -0
- package/dist/index.css +442 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +235 -0
- package/dist/index.js +592 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { ZonedDateTime } from '@internationalized/date';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type Bo4eObject = {
|
|
6
|
+
boTyp?: string;
|
|
7
|
+
} & Record<string, unknown>;
|
|
8
|
+
type Stammdaten = Record<string, Bo4eObject[]>;
|
|
9
|
+
interface DirectionDoc {
|
|
10
|
+
stammdaten: Stammdaten;
|
|
11
|
+
transaktionsdaten?: Bo4eObject;
|
|
12
|
+
zusatzdaten?: Bo4eObject;
|
|
13
|
+
}
|
|
14
|
+
interface CDoc {
|
|
15
|
+
id: string;
|
|
16
|
+
businessKey: string;
|
|
17
|
+
content: Partial<Record<string, DirectionDoc>>;
|
|
18
|
+
}
|
|
19
|
+
interface EnumDoc {
|
|
20
|
+
description?: string;
|
|
21
|
+
values: string[];
|
|
22
|
+
}
|
|
23
|
+
interface FieldDoc {
|
|
24
|
+
translation?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
example?: string;
|
|
27
|
+
pattern?: string;
|
|
28
|
+
enumRef?: string;
|
|
29
|
+
enum?: EnumDoc;
|
|
30
|
+
}
|
|
31
|
+
interface MarktpartnerInfo {
|
|
32
|
+
name: string;
|
|
33
|
+
rolle?: string;
|
|
34
|
+
}
|
|
35
|
+
interface Bo4eResolvers {
|
|
36
|
+
marktpartner?: (codenr: string, codetyp?: string) => MarktpartnerInfo | undefined;
|
|
37
|
+
enumLabel?: (enumName: string, value: string) => string | undefined;
|
|
38
|
+
obis?: (obis: string) => string | undefined;
|
|
39
|
+
pruefId?: (pi: string) => string | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare function isIsoDate(v: unknown): v is string;
|
|
43
|
+
declare function formatDateDE(iso: string, opts?: {
|
|
44
|
+
withTime?: boolean;
|
|
45
|
+
}): string;
|
|
46
|
+
declare function toUtcLabel(iso: string): string;
|
|
47
|
+
declare function zonedLabelWithTz(iso: string): string;
|
|
48
|
+
|
|
49
|
+
type ValidityState = "zukuenftig" | "aktiv" | "laeuftBald" | "abgelaufen";
|
|
50
|
+
declare function validityStatus(range: {
|
|
51
|
+
startdatum?: string | null;
|
|
52
|
+
enddatum?: string | null;
|
|
53
|
+
}, now?: Date): ValidityState;
|
|
54
|
+
|
|
55
|
+
interface Anomaly {
|
|
56
|
+
severity: "warn" | "error";
|
|
57
|
+
path: string;
|
|
58
|
+
value: unknown;
|
|
59
|
+
rule: "placeholder" | "suspiciousChar" | "defaultValue" | "implausibleDate" | "expired" | "placeholderObject";
|
|
60
|
+
message: string;
|
|
61
|
+
}
|
|
62
|
+
declare function scanAnomalies(node: unknown, opts?: {
|
|
63
|
+
now?: Date;
|
|
64
|
+
}): Anomaly[];
|
|
65
|
+
|
|
66
|
+
declare function humanize(key: string): string;
|
|
67
|
+
|
|
68
|
+
/** ISO-UTC string -> ZonedDateTime in Europe/Berlin (for the date/time picker). */
|
|
69
|
+
declare function isoToBerlin(iso: string): ZonedDateTime;
|
|
70
|
+
/** ZonedDateTime (any zone) -> normalized ISO-UTC string ("…Z", no millis). */
|
|
71
|
+
declare function berlinToIso(z: ZonedDateTime): string;
|
|
72
|
+
|
|
73
|
+
interface RawField {
|
|
74
|
+
translation?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
example?: string;
|
|
77
|
+
pattern?: string;
|
|
78
|
+
enumRef?: string;
|
|
79
|
+
}
|
|
80
|
+
interface RawEnumValue {
|
|
81
|
+
value: string;
|
|
82
|
+
}
|
|
83
|
+
interface RawEnum {
|
|
84
|
+
description?: string;
|
|
85
|
+
values: RawEnumValue[];
|
|
86
|
+
}
|
|
87
|
+
interface RawBo {
|
|
88
|
+
description?: string;
|
|
89
|
+
properties?: string[];
|
|
90
|
+
}
|
|
91
|
+
interface Bo4eSchema {
|
|
92
|
+
fields: Record<string, Record<string, RawField>>;
|
|
93
|
+
enums: Record<string, RawEnum>;
|
|
94
|
+
bos: Record<string, RawBo>;
|
|
95
|
+
}
|
|
96
|
+
declare function loadBo4eSchema(src: {
|
|
97
|
+
fields: unknown;
|
|
98
|
+
enums: unknown;
|
|
99
|
+
bos: unknown;
|
|
100
|
+
}): Bo4eSchema;
|
|
101
|
+
declare function resolveField(schema: Bo4eSchema, boTyp: string, key: string): FieldDoc;
|
|
102
|
+
declare function getFieldOrder(schema: Bo4eSchema, boTyp: string): string[];
|
|
103
|
+
|
|
104
|
+
/** A SydocView accepts a full cDoc, a single BO, or an array of BOs. */
|
|
105
|
+
type SydocInput = CDoc | Bo4eObject | Bo4eObject[];
|
|
106
|
+
/** Wrap a single BO or a BO array into a minimal cDoc (grouped by boTyp under OUTBOUND). */
|
|
107
|
+
declare function normalizeToCDoc(input: SydocInput): CDoc;
|
|
108
|
+
|
|
109
|
+
interface ValidityRangeProps {
|
|
110
|
+
start?: string | null;
|
|
111
|
+
end?: string | null;
|
|
112
|
+
now?: Date;
|
|
113
|
+
}
|
|
114
|
+
declare function ValidityRange({ start, end, now }: ValidityRangeProps): react.JSX.Element;
|
|
115
|
+
|
|
116
|
+
interface Adresse {
|
|
117
|
+
strasse?: string;
|
|
118
|
+
hausnummer?: string;
|
|
119
|
+
postleitzahl?: string;
|
|
120
|
+
ort?: string;
|
|
121
|
+
ortsteil?: string;
|
|
122
|
+
landescode?: string;
|
|
123
|
+
}
|
|
124
|
+
declare function AddressBlock({ adresse }: {
|
|
125
|
+
adresse: Adresse;
|
|
126
|
+
}): react.JSX.Element;
|
|
127
|
+
|
|
128
|
+
interface CodeResolvedProps {
|
|
129
|
+
code: string;
|
|
130
|
+
codetyp?: string;
|
|
131
|
+
resolvers?: Bo4eResolvers;
|
|
132
|
+
}
|
|
133
|
+
declare function CodeResolved({ code, codetyp, resolvers }: CodeResolvedProps): react.JSX.Element;
|
|
134
|
+
|
|
135
|
+
interface IdentityHeaderProps {
|
|
136
|
+
icon?: ReactNode;
|
|
137
|
+
title: ReactNode;
|
|
138
|
+
subtitle?: ReactNode;
|
|
139
|
+
trailing?: ReactNode;
|
|
140
|
+
}
|
|
141
|
+
declare function IdentityHeader({ icon, title, subtitle, trailing }: IdentityHeaderProps): react.JSX.Element;
|
|
142
|
+
|
|
143
|
+
declare function EnumIcon({ enumName, value }: {
|
|
144
|
+
enumName: string;
|
|
145
|
+
value: string;
|
|
146
|
+
}): react.JSX.Element | null;
|
|
147
|
+
|
|
148
|
+
type Tone = "neutral" | "positive" | "info" | "critical" | "negative";
|
|
149
|
+
declare function EnumBadge({ tone, icon, children }: {
|
|
150
|
+
tone?: Tone;
|
|
151
|
+
icon?: ReactNode;
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
}): react.JSX.Element;
|
|
154
|
+
|
|
155
|
+
declare function SchemaPopoverBody({ fieldKey, doc, value }: {
|
|
156
|
+
fieldKey: string;
|
|
157
|
+
doc: FieldDoc;
|
|
158
|
+
value: unknown;
|
|
159
|
+
}): react.JSX.Element;
|
|
160
|
+
|
|
161
|
+
interface SchemaFieldProps {
|
|
162
|
+
schema: Bo4eSchema;
|
|
163
|
+
boTyp: string;
|
|
164
|
+
fieldKey: string;
|
|
165
|
+
value: unknown;
|
|
166
|
+
children: ReactNode;
|
|
167
|
+
}
|
|
168
|
+
declare function SchemaField({ schema, boTyp, fieldKey, value, children }: SchemaFieldProps): react.JSX.Element;
|
|
169
|
+
|
|
170
|
+
interface ContactPerson {
|
|
171
|
+
anrede?: string;
|
|
172
|
+
name1?: string;
|
|
173
|
+
name2?: string;
|
|
174
|
+
name3?: string;
|
|
175
|
+
eMailAdresse?: string;
|
|
176
|
+
kontaktweg?: string[];
|
|
177
|
+
geschaeftspartnerrolle?: string[];
|
|
178
|
+
}
|
|
179
|
+
declare function ContactLine({ person }: {
|
|
180
|
+
person: ContactPerson;
|
|
181
|
+
}): react.JSX.Element;
|
|
182
|
+
|
|
183
|
+
declare function MarktpartnerRow({ row, resolvers, now }: {
|
|
184
|
+
row: Bo4eObject;
|
|
185
|
+
resolvers?: Bo4eResolvers;
|
|
186
|
+
now?: Date;
|
|
187
|
+
}): react.JSX.Element;
|
|
188
|
+
|
|
189
|
+
interface FullDetailProps {
|
|
190
|
+
schema: Bo4eSchema;
|
|
191
|
+
boTyp: string;
|
|
192
|
+
obj: Bo4eObject;
|
|
193
|
+
editable?: boolean;
|
|
194
|
+
}
|
|
195
|
+
declare function FullDetail({ schema, boTyp, obj, editable }: FullDetailProps): react.JSX.Element;
|
|
196
|
+
|
|
197
|
+
interface SmartObjectCardProps {
|
|
198
|
+
schema: Bo4eSchema;
|
|
199
|
+
boTyp: string;
|
|
200
|
+
obj: Bo4eObject;
|
|
201
|
+
header?: ReactNode;
|
|
202
|
+
children: ReactNode;
|
|
203
|
+
}
|
|
204
|
+
declare function SmartObjectCard({ schema, boTyp, obj, header, children }: SmartObjectCardProps): react.JSX.Element;
|
|
205
|
+
|
|
206
|
+
interface SmartObjectViewProps {
|
|
207
|
+
schema: Bo4eSchema;
|
|
208
|
+
obj: Bo4eObject;
|
|
209
|
+
resolvers?: Bo4eResolvers;
|
|
210
|
+
now?: Date;
|
|
211
|
+
}
|
|
212
|
+
declare function SmartObjectView({ schema, obj, resolvers, now }: SmartObjectViewProps): react.JSX.Element;
|
|
213
|
+
|
|
214
|
+
interface EditableValueProps {
|
|
215
|
+
doc: FieldDoc;
|
|
216
|
+
value: unknown;
|
|
217
|
+
onChange: (value: unknown) => void;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Schema-getriebenes Eingabe-Widget für ein einzelnes Feld:
|
|
221
|
+
* Enum → Select, Boolean → Switch, Zahl → NumberField, ISO-Datum → DateField
|
|
222
|
+
* (Anzeige in Europe/Berlin, Rückgabe als ISO-UTC), sonst Freitext.
|
|
223
|
+
*/
|
|
224
|
+
declare function EditableValue({ doc, value, onChange }: EditableValueProps): react.JSX.Element;
|
|
225
|
+
|
|
226
|
+
interface SydocViewProps {
|
|
227
|
+
/** Full cDoc, a single BO, or an array of BOs. */
|
|
228
|
+
doc: SydocInput;
|
|
229
|
+
schema: Bo4eSchema;
|
|
230
|
+
resolvers?: Bo4eResolvers;
|
|
231
|
+
now?: Date;
|
|
232
|
+
}
|
|
233
|
+
declare function SydocView({ doc, schema, resolvers, now }: SydocViewProps): react.JSX.Element | null;
|
|
234
|
+
|
|
235
|
+
export { AddressBlock, type Adresse, type Anomaly, type Bo4eObject, type Bo4eResolvers, type Bo4eSchema, type CDoc, CodeResolved, type CodeResolvedProps, ContactLine, type ContactPerson, type DirectionDoc, EditableValue, type EditableValueProps, EnumBadge, type EnumDoc, EnumIcon, type FieldDoc, FullDetail, type FullDetailProps, IdentityHeader, type IdentityHeaderProps, type MarktpartnerInfo, MarktpartnerRow, SchemaField, type SchemaFieldProps, SchemaPopoverBody, SmartObjectCard, type SmartObjectCardProps, SmartObjectView, type SmartObjectViewProps, type Stammdaten, type SydocInput, SydocView, type SydocViewProps, type Tone, ValidityRange, type ValidityRangeProps, type ValidityState, berlinToIso, formatDateDE, getFieldOrder, humanize, isIsoDate, isoToBerlin, loadBo4eSchema, normalizeToCDoc, resolveField, scanAnomalies, toUtcLabel, validityStatus, zonedLabelWithTz };
|