@yomotech/view-toolkit 1.0.37 → 1.0.39
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/fesm2022/yomotech-view-toolkit-catalog.mjs +674 -0
- package/fesm2022/yomotech-view-toolkit-catalog.mjs.map +1 -0
- package/fesm2022/yomotech-view-toolkit.mjs +5767 -3195
- package/fesm2022/yomotech-view-toolkit.mjs.map +1 -1
- package/package.json +5 -1
- package/types/yomotech-view-toolkit-catalog.d.ts +216 -0
- package/types/yomotech-view-toolkit.d.ts +765 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yomotech/view-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/cdk": "^21.0.0",
|
|
6
6
|
"@angular/common": "^21.0.0",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
".": {
|
|
43
43
|
"types": "./types/yomotech-view-toolkit.d.ts",
|
|
44
44
|
"default": "./fesm2022/yomotech-view-toolkit.mjs"
|
|
45
|
+
},
|
|
46
|
+
"./catalog": {
|
|
47
|
+
"types": "./types/yomotech-view-toolkit-catalog.d.ts",
|
|
48
|
+
"default": "./fesm2022/yomotech-view-toolkit-catalog.mjs"
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/** Pure policy shared by inspectors and layout validation. No DTO mutation. */
|
|
2
|
+
type Bag = Record<string, any>;
|
|
3
|
+
interface Setting {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
kind: 'text' | 'number' | 'select' | 'json';
|
|
7
|
+
values?: string[];
|
|
8
|
+
hint?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const clone: <T>(value: T) => T;
|
|
11
|
+
declare function resolveProperty(root: Bag | any, reference: string): Bag;
|
|
12
|
+
declare function normalizeFormat(value: string): string;
|
|
13
|
+
declare function baseType(schema: Bag | any, fallback: string): string;
|
|
14
|
+
declare function effectiveFormat(schema: Bag | any, fallback: string, data: Bag | any): string;
|
|
15
|
+
declare function rulesFor(schema: Bag | any, data: Bag | any): Bag;
|
|
16
|
+
declare function controlsFor(schema: Bag, fallback: string, option: Bag | any): {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}[];
|
|
20
|
+
declare const canonicalControl: (c: string) => any;
|
|
21
|
+
/** The data types of a property after its aliases. */
|
|
22
|
+
declare const BASIC_TYPES: readonly ["string", "number", "integer", "bigdecimal", "boolean", "date", "time", "datetime", "dateRange", "media", "array"];
|
|
23
|
+
/** Older or other names of a data type and the type they mean. */
|
|
24
|
+
declare const TYPE_ALIASES: Bag;
|
|
25
|
+
/** The data type of a property, aliases resolved ("image" -> "media"). */
|
|
26
|
+
declare function basicType(property: Bag | any): string;
|
|
27
|
+
/** Every control the Designer offers (option.control), with the name it is shown under. */
|
|
28
|
+
declare const CONTROLS: Bag;
|
|
29
|
+
/** DTO types that name their control themselves (older projects). */
|
|
30
|
+
declare const CONTROL_TYPES: Bag;
|
|
31
|
+
/**
|
|
32
|
+
* The control a field is shown with: option.control; without one what the app uses - an old switch
|
|
33
|
+
* (password, email, timeOnly), a DTO type that is a control (dropdown, creditCard, quantity), else
|
|
34
|
+
* the first control that fits the data (date -> datepicker, boolean -> checkbox, text -> textInput).
|
|
35
|
+
* '' when nothing fits (media, objects).
|
|
36
|
+
*/
|
|
37
|
+
declare function effectiveControl(option: Bag | any, schema?: Bag | any, fallback?: string): string;
|
|
38
|
+
/** Controls a value is typed or chosen in - they take a placeholder. */
|
|
39
|
+
declare const PLACEHOLDER_CONTROLS: string[];
|
|
40
|
+
/** The toolkit keyboards a field can ask for (option.keyboardType). */
|
|
41
|
+
declare const KEYBOARD_TYPES: readonly ["string", "alpha", "numeric", "email", "date", "time"];
|
|
42
|
+
/** keyboardType values that keep the device's system keyboard. */
|
|
43
|
+
declare const SYSTEM_KEYBOARDS: readonly ["native", "none"];
|
|
44
|
+
/** Controls a keyboard is chosen for. */
|
|
45
|
+
declare const KEYBOARD_CONTROLS: string[];
|
|
46
|
+
/** The keyboard a control brings when the field names none (as the Designer preselects it). */
|
|
47
|
+
declare function defaultKeyboard(control: string, schema?: Bag | any, fallback?: string, data?: Bag | any): string;
|
|
48
|
+
/**
|
|
49
|
+
* The keyboard of a field: its keyboardType; native/none (and a password without one) keep the
|
|
50
|
+
* system keyboard (null); without keyboardType the control's default; without a control the data
|
|
51
|
+
* type's (date, time, number/integer, string, email format). The per-type keyboards are only the
|
|
52
|
+
* fallback.
|
|
53
|
+
*/
|
|
54
|
+
declare function keyboardFor(option: Bag | any, property?: Bag | any): string | null;
|
|
55
|
+
/** What a date/time property shows and takes: date and time stay separate fields. */
|
|
56
|
+
type TemporalPart = 'date' | 'time' | 'datetime';
|
|
57
|
+
/** The part of a date/time a property shows and takes (DTO type date / time / date&time), else null. */
|
|
58
|
+
declare function temporalPart(property: Bag | any): TemporalPart | null;
|
|
59
|
+
/**
|
|
60
|
+
* How date and time values travel - the same for every project:
|
|
61
|
+
* - every value is a string (JSON has no date type); the app turns it into a date for showing and
|
|
62
|
+
* back into a string for sending, steered by the DTO type alone
|
|
63
|
+
* - read: ISO, date and time, a value without timezone is local wall time; Z or an offset is
|
|
64
|
+
* dropped (wall time) - P5W1 sends 2025-11-04T16:30:00
|
|
65
|
+
* - send: ISO with the device's offset, 2026-10-18T08:00:00+02:00 (the daily split of the time
|
|
66
|
+
* recording, convertToDailyLogs, stays as it is)
|
|
67
|
+
* - shown and typed: the app language, year with four digits (de 18.10.2026, time 08:05);
|
|
68
|
+
* lists: displayFormat short / medium (default) / long / custom
|
|
69
|
+
*/
|
|
70
|
+
declare const TEMPORAL_TRANSFER: {
|
|
71
|
+
readonly read: "iso, local wall time, offset dropped";
|
|
72
|
+
readonly send: "iso with local offset";
|
|
73
|
+
readonly show: "app language, four-digit year";
|
|
74
|
+
readonly listStyles: readonly ["short", "medium", "long", "custom"];
|
|
75
|
+
readonly listDefault: "medium";
|
|
76
|
+
};
|
|
77
|
+
/** The encodings a field can declare (option.fieldData.format). */
|
|
78
|
+
declare const DATA_FORMATS: readonly ["iso-date", "iso-time", "iso-datetime", "flag", "decimal"];
|
|
79
|
+
/** How a date or time is shown (option.displayFormat). */
|
|
80
|
+
declare const DISPLAY_FORMATS: readonly ["short", "medium", "long", "custom"];
|
|
81
|
+
/** How a number is shown (option.numberStyle). */
|
|
82
|
+
declare const NUMBER_STYLES: readonly ["decimal", "currency", "percent"];
|
|
83
|
+
declare function displaySettings(schema: Bag, fallback: string, option: Bag | any): Setting[];
|
|
84
|
+
declare function dataSettings(schema: Bag, fallback: string, option: Bag | any): Setting[];
|
|
85
|
+
declare function validationSettings(schema: Bag, fallback: string, option: Bag | any): Setting[];
|
|
86
|
+
declare function validateSettings(schema: Bag | any, fallback: string, option: Bag | any, context?: {
|
|
87
|
+
propertySchema: Bag;
|
|
88
|
+
reference: string;
|
|
89
|
+
allowPendingValues?: boolean;
|
|
90
|
+
}): string[];
|
|
91
|
+
/** Call before activating a saved field layout; throws rather than warning. */
|
|
92
|
+
declare function assertFieldSettings(schema: Bag, fallback: string, option: Bag, context?: {
|
|
93
|
+
propertySchema: Bag;
|
|
94
|
+
reference: string;
|
|
95
|
+
allowPendingValues?: boolean;
|
|
96
|
+
}): void;
|
|
97
|
+
|
|
98
|
+
declare const TESTS_DIR = ".liveforge/tests";
|
|
99
|
+
declare const RESULTS_DIR = ".liveforge/results";
|
|
100
|
+
declare const TEST_DEVICES: readonly ["phone", "tablet", "laptop", "desktop"];
|
|
101
|
+
declare const ORIENTATIONS: readonly ["portrait", "landscape"];
|
|
102
|
+
declare const STEP_KINDS: readonly ["open", "tap", "type", "pick", "press", "rotate", "device", "wait", "expect"];
|
|
103
|
+
/** What an expect step can check - one of them per step. */
|
|
104
|
+
declare const EXPECT_KINDS: readonly ["value", "shows", "keyboard", "list", "message", "visible", "hidden", "locked", "blocked", "inFrame"];
|
|
105
|
+
/** What has to stay inside the page frame (safe areas, top gap). */
|
|
106
|
+
declare const FRAME_PARTS: readonly ["keyboard", "dialog", "calendar", "list", "menu"];
|
|
107
|
+
declare const LIST_STATES: readonly ["open", "closed"];
|
|
108
|
+
type TestDevice = typeof TEST_DEVICES[number];
|
|
109
|
+
type Orientation = typeof ORIENTATIONS[number];
|
|
110
|
+
interface TestExpect {
|
|
111
|
+
field?: string;
|
|
112
|
+
/** stored value of the field */
|
|
113
|
+
value?: unknown;
|
|
114
|
+
/** text the field shows (formatted: "12,34 €", "01:00 PM") */
|
|
115
|
+
shows?: string;
|
|
116
|
+
/** keyboard type that is open (string, alpha, numeric, email, date, time) or "none" */
|
|
117
|
+
keyboard?: string;
|
|
118
|
+
list?: typeof LIST_STATES[number];
|
|
119
|
+
/** message key of a check (required, minLength, dateOrder …) */
|
|
120
|
+
message?: string;
|
|
121
|
+
visible?: string;
|
|
122
|
+
hidden?: string;
|
|
123
|
+
locked?: string;
|
|
124
|
+
/** a button that writes real data is there and this flow may not press it (the runner's lock) */
|
|
125
|
+
blocked?: string;
|
|
126
|
+
inFrame?: typeof FRAME_PARTS[number];
|
|
127
|
+
}
|
|
128
|
+
interface TestStep {
|
|
129
|
+
open?: string;
|
|
130
|
+
tap?: string;
|
|
131
|
+
type?: string;
|
|
132
|
+
into?: string;
|
|
133
|
+
pick?: string;
|
|
134
|
+
in?: string;
|
|
135
|
+
press?: string;
|
|
136
|
+
rotate?: Orientation;
|
|
137
|
+
device?: string;
|
|
138
|
+
/** milliseconds */
|
|
139
|
+
wait?: number;
|
|
140
|
+
expect?: TestExpect;
|
|
141
|
+
}
|
|
142
|
+
interface TestFlow {
|
|
143
|
+
name: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
/** writes real data - runs only after an explicit confirmation */
|
|
146
|
+
books?: boolean;
|
|
147
|
+
/** "phone", "tablet:landscape" … - without orientation portrait; none means phone and tablet */
|
|
148
|
+
devices?: string[];
|
|
149
|
+
steps: TestStep[];
|
|
150
|
+
}
|
|
151
|
+
interface TestProblem {
|
|
152
|
+
code: string;
|
|
153
|
+
step?: number;
|
|
154
|
+
params?: Record<string, string>;
|
|
155
|
+
}
|
|
156
|
+
/** One step's outcome in a run. image: screenshot of a failed step (data URL or file in results). */
|
|
157
|
+
interface StepResult {
|
|
158
|
+
step: number;
|
|
159
|
+
ok: boolean;
|
|
160
|
+
reason?: string;
|
|
161
|
+
image?: string;
|
|
162
|
+
}
|
|
163
|
+
interface FlowResult {
|
|
164
|
+
file: string;
|
|
165
|
+
name: string;
|
|
166
|
+
device: string;
|
|
167
|
+
ok: boolean;
|
|
168
|
+
skipped?: 'books';
|
|
169
|
+
/** stopped by the person ("Stop") after this flow's last step in steps */
|
|
170
|
+
stopped?: boolean;
|
|
171
|
+
steps: StepResult[];
|
|
172
|
+
}
|
|
173
|
+
/** One run, stored as .liveforge/results/<date-time>.json (the backend keeps the latest runs). */
|
|
174
|
+
interface TestRun {
|
|
175
|
+
project: string;
|
|
176
|
+
tenant: string;
|
|
177
|
+
startedAt: string;
|
|
178
|
+
finishedAt?: string;
|
|
179
|
+
/** the person stopped the run - flows after it did not run */
|
|
180
|
+
stopped?: boolean;
|
|
181
|
+
flows: FlowResult[];
|
|
182
|
+
}
|
|
183
|
+
declare const DEFAULT_DEVICES: string[];
|
|
184
|
+
/**
|
|
185
|
+
* How many runs the backend keeps in .liveforge/results - defaults, the project configuration can
|
|
186
|
+
* change them: at most `max` runs; while they together are bigger than `maxBytes` (mostly images of
|
|
187
|
+
* failed steps) the oldest go, but `min` runs always stay. Results are not exported.
|
|
188
|
+
*/
|
|
189
|
+
declare const RESULTS_KEEP: {
|
|
190
|
+
max: number;
|
|
191
|
+
min: number;
|
|
192
|
+
maxBytes: number;
|
|
193
|
+
};
|
|
194
|
+
/** The runs to delete, oldest first; runs: name (sortable by date-time) and size in bytes. */
|
|
195
|
+
declare function resultsToDelete(runs: {
|
|
196
|
+
name: string;
|
|
197
|
+
size: number;
|
|
198
|
+
}[], keep?: {
|
|
199
|
+
max: number;
|
|
200
|
+
min: number;
|
|
201
|
+
maxBytes: number;
|
|
202
|
+
}): string[];
|
|
203
|
+
/** "tablet:landscape" → { device: 'tablet', orientation: 'landscape' }; null when unknown. */
|
|
204
|
+
declare function parseDevice(text: string): {
|
|
205
|
+
device: TestDevice;
|
|
206
|
+
orientation: Orientation;
|
|
207
|
+
} | null;
|
|
208
|
+
/** The devices a flow runs on. */
|
|
209
|
+
declare function flowDevices(flow: TestFlow): string[];
|
|
210
|
+
/** The kind of a step - the first step key it has. */
|
|
211
|
+
declare function stepKind(step: TestStep): string | null;
|
|
212
|
+
/** The problems of a flow; an empty list means it can run. */
|
|
213
|
+
declare function checkTestFlow(flow: any): TestProblem[];
|
|
214
|
+
|
|
215
|
+
export { BASIC_TYPES, CONTROLS, CONTROL_TYPES, DATA_FORMATS, DEFAULT_DEVICES, DISPLAY_FORMATS, EXPECT_KINDS, FRAME_PARTS, KEYBOARD_CONTROLS, KEYBOARD_TYPES, LIST_STATES, NUMBER_STYLES, ORIENTATIONS, PLACEHOLDER_CONTROLS, RESULTS_DIR, RESULTS_KEEP, STEP_KINDS, SYSTEM_KEYBOARDS, TEMPORAL_TRANSFER, TESTS_DIR, TEST_DEVICES, TYPE_ALIASES, assertFieldSettings, baseType, basicType, canonicalControl, checkTestFlow, clone, controlsFor, dataSettings, defaultKeyboard, displaySettings, effectiveControl, effectiveFormat, flowDevices, keyboardFor, normalizeFormat, parseDevice, resolveProperty, resultsToDelete, rulesFor, stepKind, temporalPart, validateSettings, validationSettings };
|
|
216
|
+
export type { Bag, FlowResult, Orientation, Setting, StepResult, TemporalPart, TestDevice, TestExpect, TestFlow, TestProblem, TestRun, TestStep };
|