@planeasyinc/fe-core 0.1.24 → 0.1.25
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/dist/conditions.d.ts +7 -0
- package/dist/conditions.d.ts.map +1 -0
- package/dist/conditions.js +62 -0
- package/dist/conditions.js.map +1 -0
- package/dist/control-traverser.d.ts +3 -0
- package/dist/control-traverser.d.ts.map +1 -0
- package/dist/control-traverser.js +15 -0
- package/dist/control-traverser.js.map +1 -0
- package/dist/engine.d.ts +102 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +506 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +8 -584
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -815
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +41 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +98 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema-guard.d.ts +3 -0
- package/dist/schema-guard.d.ts.map +1 -0
- package/dist/schema-guard.js +50 -0
- package/dist/schema-guard.js.map +1 -0
- package/dist/types-list.d.ts +3 -0
- package/dist/types-list.d.ts.map +1 -0
- package/dist/types-list.js +43 -0
- package/dist/types-list.js.map +1 -0
- package/dist/types.d.ts +424 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validators/default-validators.d.ts +4 -0
- package/dist/validators/default-validators.d.ts.map +1 -0
- package/dist/validators/default-validators.js +171 -0
- package/dist/validators/default-validators.js.map +1 -0
- package/dist/validators/index.d.ts +5 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +5 -0
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/pattern-cache.d.ts +2 -0
- package/dist/validators/pattern-cache.d.ts.map +1 -0
- package/dist/validators/pattern-cache.js +27 -0
- package/dist/validators/pattern-cache.js.map +1 -0
- package/dist/validators/registry.d.ts +14 -0
- package/dist/validators/registry.d.ts.map +1 -0
- package/dist/validators/registry.js +24 -0
- package/dist/validators/registry.js.map +1 -0
- package/dist/validators/types.d.ts +15 -0
- package/dist/validators/types.d.ts.map +1 -0
- package/dist/validators/types.js +2 -0
- package/dist/validators/types.js.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,584 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
type FeControlType = 'text' | 'email' | 'phone' | 'password' | 'paragraph' | 'header' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'toggle' | 'textarea' | 'number' | 'number-plus' | 'number-minus' | 'number-equals' | 'number-initial' | 'number-operations' | 'slider' | 'number-slider' | 'date' | 'datetime' | 'time' | 'date-triplet' | 'array' | 'object' | 'object-latest' | 'object-group' | 'group' | 'group-toggle' | 'tabs' | 'tab' | 'row' | 'column' | 'dict' | 'file' | 'dropzone' | 'attachment' | 'bytes' | 'mask' | 'infoscreen' | 'json' | 'info-group' | 'chat' | 'button' | 'sections' | 'section';
|
|
11
|
-
/**
|
|
12
|
-
* ControlValueType - type of value that will be returned
|
|
13
|
-
*
|
|
14
|
-
* Mirrors console ControlValueType with framework-agnostic adaptations:
|
|
15
|
-
* - Console uses { ref: IObjectReference } for object references
|
|
16
|
-
* - Console uses ChatMessage[] for chat controls
|
|
17
|
-
* - File[] represents uploaded files (console uses base64 strings or File objects)
|
|
18
|
-
* - Date triplet uses { day, month, year } or Date object (console uses Date)
|
|
19
|
-
*/
|
|
20
|
-
type FeControlValueType = string | number | boolean | null | undefined | string[] | number[] | unknown[] | Record<string, string[] | number[] | string | number | boolean | null | undefined> | File[] | {
|
|
21
|
-
day?: number;
|
|
22
|
-
month?: number;
|
|
23
|
-
year?: number;
|
|
24
|
-
} | {
|
|
25
|
-
message: string;
|
|
26
|
-
ts: number;
|
|
27
|
-
} | {
|
|
28
|
-
ref: {
|
|
29
|
-
address: string | null;
|
|
30
|
-
version_id: string | null;
|
|
31
|
-
display_name?: string;
|
|
32
|
-
};
|
|
33
|
-
} | Array<{
|
|
34
|
-
role: 'user' | 'assistant' | 'system';
|
|
35
|
-
content: string;
|
|
36
|
-
timestamp?: string;
|
|
37
|
-
attachments?: any[];
|
|
38
|
-
}>;
|
|
39
|
-
/**
|
|
40
|
-
* Condition - type used in group validators
|
|
41
|
-
*/
|
|
42
|
-
type FeCondition = 'lt' | 'gt' | 'eq' | 'lte' | 'gte' | 'neq' | 'exists' | 'in' | 'contains';
|
|
43
|
-
/**
|
|
44
|
-
* Simple condition for single field check
|
|
45
|
-
*/
|
|
46
|
-
interface FeSimpleCondition {
|
|
47
|
-
field: string;
|
|
48
|
-
condition: FeCondition;
|
|
49
|
-
value?: any;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Group condition for complex logical expressions
|
|
53
|
-
*/
|
|
54
|
-
interface FeGroupCondition {
|
|
55
|
-
operator: 'and' | 'or' | 'nand' | 'nor' | 'xor';
|
|
56
|
-
conditions: Array<FeSimpleCondition | FeGroupCondition>;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Control validator configuration
|
|
60
|
-
*/
|
|
61
|
-
interface FeControlValidatorConfig {
|
|
62
|
-
function: string;
|
|
63
|
-
value?: number | string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Group validator configuration
|
|
67
|
-
*/
|
|
68
|
-
interface FeGroupValidatorConfig {
|
|
69
|
-
function: string;
|
|
70
|
-
mainControl: string;
|
|
71
|
-
dependentControls: string[];
|
|
72
|
-
value?: any;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Activator configuration
|
|
76
|
-
*/
|
|
77
|
-
interface FeActivatorConfig {
|
|
78
|
-
condition: FeCondition;
|
|
79
|
-
mainControl: string;
|
|
80
|
-
dependentControls: string[];
|
|
81
|
-
value?: any;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Backend condition configuration (JSON format)
|
|
85
|
-
*/
|
|
86
|
-
interface FeBackendCondition {
|
|
87
|
-
operation: 'and' | 'or';
|
|
88
|
-
conditions: Array<{
|
|
89
|
-
target_id: string;
|
|
90
|
-
condition: FeCondition;
|
|
91
|
-
value?: any;
|
|
92
|
-
}>;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Backend simple validation condition
|
|
96
|
-
*/
|
|
97
|
-
interface FeBackendSimpleCondition {
|
|
98
|
-
target_id: string;
|
|
99
|
-
field?: string;
|
|
100
|
-
condition: FeCondition;
|
|
101
|
-
value?: any;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Backend validation condition group
|
|
105
|
-
*/
|
|
106
|
-
interface FeBackendConditionGroup {
|
|
107
|
-
operation?: 'and' | 'or';
|
|
108
|
-
operator?: 'and' | 'or';
|
|
109
|
-
conditions: Array<FeBackendSimpleCondition | FeBackendConditionGroup>;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Backend validation - can be either a simple condition or a condition group
|
|
113
|
-
*/
|
|
114
|
-
type FeBackendValidation = FeBackendConditionGroup | FeBackendSimpleCondition;
|
|
115
|
-
/**
|
|
116
|
-
* Form Engine Action
|
|
117
|
-
*/
|
|
118
|
-
interface FeActionBase {
|
|
119
|
-
type: string;
|
|
120
|
-
}
|
|
121
|
-
interface UpdateApiActionBase {
|
|
122
|
-
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
123
|
-
url: string;
|
|
124
|
-
async?: boolean;
|
|
125
|
-
body?: {
|
|
126
|
-
[key: string]: any;
|
|
127
|
-
};
|
|
128
|
-
onSuccess?: FeControlAction[];
|
|
129
|
-
onError?: FeControlAction[];
|
|
130
|
-
}
|
|
131
|
-
interface ControlSourceStatic {
|
|
132
|
-
type: 'static';
|
|
133
|
-
static_value: Record<string, any>;
|
|
134
|
-
}
|
|
135
|
-
interface ControlSourceDynamic {
|
|
136
|
-
type: 'dynamic';
|
|
137
|
-
dynamic_value: {
|
|
138
|
-
entity_name: string;
|
|
139
|
-
type: 'transaction' | 'object';
|
|
140
|
-
body?: {
|
|
141
|
-
[key: string]: any;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
interface FeUpdateValueAction extends FeActionBase {
|
|
146
|
-
type: 'update_value';
|
|
147
|
-
field_id: string;
|
|
148
|
-
value: any;
|
|
149
|
-
}
|
|
150
|
-
interface FeUpdateFormAction extends FeActionBase {
|
|
151
|
-
type: 'update_form';
|
|
152
|
-
control_source: ControlSourceDynamic | ControlSourceStatic;
|
|
153
|
-
}
|
|
154
|
-
interface FeUpdateTableAction extends FeActionBase {
|
|
155
|
-
type: 'update_table';
|
|
156
|
-
data_source: {
|
|
157
|
-
entity_name: string;
|
|
158
|
-
type: 'transaction' | 'class';
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
interface FeInvokeAction extends FeActionBase, UpdateApiActionBase {
|
|
162
|
-
type: 'invoke';
|
|
163
|
-
}
|
|
164
|
-
interface FeShowPopupAction extends FeActionBase {
|
|
165
|
-
type: 'show_popup';
|
|
166
|
-
[key: string]: any;
|
|
167
|
-
}
|
|
168
|
-
interface FeNavigateToSectionAction extends FeActionBase {
|
|
169
|
-
type: 'navigate_to_section';
|
|
170
|
-
section_id: string;
|
|
171
|
-
}
|
|
172
|
-
interface FeOpenUrlAction extends FeActionBase {
|
|
173
|
-
type: 'open_url';
|
|
174
|
-
url: string;
|
|
175
|
-
}
|
|
176
|
-
interface FeDownloadAction extends FeActionBase {
|
|
177
|
-
type: 'download';
|
|
178
|
-
payload: any;
|
|
179
|
-
}
|
|
180
|
-
interface FeAlignValuesAction extends FeActionBase {
|
|
181
|
-
type: 'align_values';
|
|
182
|
-
source: FeControlConfig;
|
|
183
|
-
target: FeControlConfig;
|
|
184
|
-
}
|
|
185
|
-
interface FeScrollTopAction extends FeActionBase {
|
|
186
|
-
type: 'scroll_top';
|
|
187
|
-
}
|
|
188
|
-
type FeControlAction = FeInvokeAction | FeUpdateFormAction | FeUpdateTableAction | FeUpdateValueAction | FeShowPopupAction | FeNavigateToSectionAction | FeOpenUrlAction | FeDownloadAction | FeAlignValuesAction | FeScrollTopAction;
|
|
189
|
-
/**
|
|
190
|
-
* Base form item configuration (shared by all control types)
|
|
191
|
-
*
|
|
192
|
-
* Mirrors console BaseFormItemConfig with framework-agnostic adaptations.
|
|
193
|
-
* All console-specific metadata is carried in the meta property.
|
|
194
|
-
*/
|
|
195
|
-
interface FeBaseFormItemConfig {
|
|
196
|
-
id: string;
|
|
197
|
-
type: FeControlType;
|
|
198
|
-
name: string;
|
|
199
|
-
label?: string;
|
|
200
|
-
required?: boolean;
|
|
201
|
-
hideLabel?: boolean;
|
|
202
|
-
readOnly?: boolean;
|
|
203
|
-
validators?: FeControlValidatorConfig[] | FeGroupValidatorConfig[];
|
|
204
|
-
activators?: FeActivatorConfig[];
|
|
205
|
-
additionalText?: string;
|
|
206
|
-
uiSection?: {
|
|
207
|
-
id: string;
|
|
208
|
-
label?: string;
|
|
209
|
-
order?: number;
|
|
210
|
-
};
|
|
211
|
-
condition?: FeBackendSimpleCondition | FeBackendConditionGroup;
|
|
212
|
-
validation?: FeBackendValidation;
|
|
213
|
-
meta?: {
|
|
214
|
-
options?: Array<{
|
|
215
|
-
label: string;
|
|
216
|
-
value: string;
|
|
217
|
-
}>;
|
|
218
|
-
control?: FeControlConfig;
|
|
219
|
-
controls?: FeControlConfig[];
|
|
220
|
-
styles?: Record<string, string | number>;
|
|
221
|
-
mask?: string | {
|
|
222
|
-
mask_string?: string;
|
|
223
|
-
pattern?: string;
|
|
224
|
-
placeholder?: string;
|
|
225
|
-
prefix?: string;
|
|
226
|
-
suffix?: string;
|
|
227
|
-
thousands_separator?: string;
|
|
228
|
-
[k: string]: any;
|
|
229
|
-
};
|
|
230
|
-
onFocus?: Array<FeInvokeAction>;
|
|
231
|
-
onBlur?: Array<FeInvokeAction>;
|
|
232
|
-
numberKind?: 'plus' | 'minus' | 'equals' | 'initial';
|
|
233
|
-
slider?: {
|
|
234
|
-
min: number;
|
|
235
|
-
max: number;
|
|
236
|
-
step?: number;
|
|
237
|
-
discrete?: boolean;
|
|
238
|
-
prefix?: string;
|
|
239
|
-
number_format?: string;
|
|
240
|
-
auto_compute_monthly?: string;
|
|
241
|
-
};
|
|
242
|
-
dateTripletMeta?: {
|
|
243
|
-
dayKey: string;
|
|
244
|
-
monthKey: string;
|
|
245
|
-
yearKey: string;
|
|
246
|
-
};
|
|
247
|
-
dictMeta?: {
|
|
248
|
-
source: string;
|
|
249
|
-
valueKey?: string;
|
|
250
|
-
labelKey?: string;
|
|
251
|
-
options?: Array<{
|
|
252
|
-
label: string;
|
|
253
|
-
value: string;
|
|
254
|
-
}>;
|
|
255
|
-
};
|
|
256
|
-
attachmentMeta?: {
|
|
257
|
-
multiple?: boolean;
|
|
258
|
-
accept?: string[];
|
|
259
|
-
maxSizeMb?: number;
|
|
260
|
-
};
|
|
261
|
-
infoscreenMeta?: {
|
|
262
|
-
title?: string;
|
|
263
|
-
html?: string;
|
|
264
|
-
};
|
|
265
|
-
buttonMeta?: {
|
|
266
|
-
label: string;
|
|
267
|
-
action?: 'submit' | 'next' | 'custom';
|
|
268
|
-
payload?: any;
|
|
269
|
-
actions?: FeControlAction[];
|
|
270
|
-
};
|
|
271
|
-
chatMeta?: {
|
|
272
|
-
endpoint: string;
|
|
273
|
-
contextKey?: string;
|
|
274
|
-
};
|
|
275
|
-
toggle?: boolean;
|
|
276
|
-
entityType?: string;
|
|
277
|
-
showSearch?: boolean;
|
|
278
|
-
customLabel?: string[];
|
|
279
|
-
operations?: Array<{
|
|
280
|
-
operator: 'sum' | 'min' | 'div' | 'multi' | 'eq';
|
|
281
|
-
additionalText?: string;
|
|
282
|
-
[key: string]: any;
|
|
283
|
-
}>;
|
|
284
|
-
[key: string]: any;
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Base control configuration (extends base with value and placeholder)
|
|
289
|
-
*/
|
|
290
|
-
interface FeBaseControlConfig extends FeBaseFormItemConfig {
|
|
291
|
-
value?: FeControlValueType;
|
|
292
|
-
placeholder?: string;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Text mask configuration
|
|
296
|
-
*
|
|
297
|
-
* Mirrors console ITextMask interface:
|
|
298
|
-
* - mask_string: string pattern (e.g., '(00)-000-000' for phone)
|
|
299
|
-
* - prefix: optional prefix (e.g., '$' for currency)
|
|
300
|
-
* - suffix: optional suffix
|
|
301
|
-
* - thousands_separator: optional separator (e.g., ',' for 100,000)
|
|
302
|
-
*/
|
|
303
|
-
interface FeTextMask {
|
|
304
|
-
mask?: string | {
|
|
305
|
-
mask_string?: string;
|
|
306
|
-
pattern?: string;
|
|
307
|
-
placeholder?: string;
|
|
308
|
-
prefix?: string;
|
|
309
|
-
suffix?: string;
|
|
310
|
-
thousands_separator?: string;
|
|
311
|
-
[k: string]: any;
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Selectable control configuration
|
|
316
|
-
*/
|
|
317
|
-
interface FeSingleSelectControlConfig extends FeBaseControlConfig, FeTextMask {
|
|
318
|
-
type: 'select' | 'radio';
|
|
319
|
-
options: Array<{
|
|
320
|
-
label: string;
|
|
321
|
-
value: string;
|
|
322
|
-
}>;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Multi-select control configuration
|
|
326
|
-
*/
|
|
327
|
-
interface FeMultiSelectControlConfig extends FeBaseControlConfig {
|
|
328
|
-
type: 'multiselect' | 'checkbox';
|
|
329
|
-
options: Array<{
|
|
330
|
-
label: string;
|
|
331
|
-
value: string;
|
|
332
|
-
}>;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Text control configuration
|
|
336
|
-
*/
|
|
337
|
-
interface FeTextControlConfig extends FeBaseControlConfig, FeTextMask {
|
|
338
|
-
type: 'text' | 'email' | 'phone' | 'password';
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Number slider control configuration
|
|
342
|
-
*/
|
|
343
|
-
interface FeNumberSliderControlConfig extends FeBaseControlConfig {
|
|
344
|
-
type: 'number-slider' | 'slider';
|
|
345
|
-
meta?: {
|
|
346
|
-
slider: {
|
|
347
|
-
min: number;
|
|
348
|
-
max: number;
|
|
349
|
-
step?: number;
|
|
350
|
-
discrete?: boolean;
|
|
351
|
-
};
|
|
352
|
-
[key: string]: any;
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Number operations control configuration
|
|
357
|
-
*/
|
|
358
|
-
interface FeNumberOperationsControlConfig extends FeBaseControlConfig {
|
|
359
|
-
type: 'number-operations';
|
|
360
|
-
operations?: any[];
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Array control configuration
|
|
364
|
-
*/
|
|
365
|
-
interface FeArrayControlConfig extends FeBaseControlConfig {
|
|
366
|
-
type: 'array';
|
|
367
|
-
control: FeControlConfig;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Object control configuration
|
|
371
|
-
*/
|
|
372
|
-
interface FeObjectControlConfig extends FeBaseControlConfig {
|
|
373
|
-
type: 'object' | 'object-latest';
|
|
374
|
-
controls?: FeControlConfig[];
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Group control configuration
|
|
378
|
-
*/
|
|
379
|
-
interface FeGroupControlConfig extends FeBaseControlConfig {
|
|
380
|
-
type: 'group' | 'object-group' | 'group-toggle' | 'sections' | 'tabs' | 'tab' | 'row' | 'column';
|
|
381
|
-
controls: FeControlConfig[];
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Dictionary control configuration
|
|
385
|
-
*/
|
|
386
|
-
interface FeDictControlConfig extends FeBaseControlConfig {
|
|
387
|
-
type: 'dict';
|
|
388
|
-
meta?: {
|
|
389
|
-
dictMeta: {
|
|
390
|
-
source: string;
|
|
391
|
-
valueKey?: string;
|
|
392
|
-
labelKey?: string;
|
|
393
|
-
options?: Array<{
|
|
394
|
-
label: string;
|
|
395
|
-
value: string;
|
|
396
|
-
}>;
|
|
397
|
-
};
|
|
398
|
-
dictKey?: string;
|
|
399
|
-
[key: string]: any;
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Union of all control configurations
|
|
404
|
-
*/
|
|
405
|
-
type FeControlConfig = FeBaseControlConfig | FeSingleSelectControlConfig | FeMultiSelectControlConfig | FeTextControlConfig | FeNumberSliderControlConfig | FeNumberOperationsControlConfig | FeArrayControlConfig | FeObjectControlConfig | FeGroupControlConfig | FeDictControlConfig;
|
|
406
|
-
/**
|
|
407
|
-
* Section configuration
|
|
408
|
-
*/
|
|
409
|
-
interface FeSection {
|
|
410
|
-
id: string;
|
|
411
|
-
label?: string;
|
|
412
|
-
order?: number;
|
|
413
|
-
controls: FeControlConfig[];
|
|
414
|
-
condition?: FeBackendCondition;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Form configuration
|
|
418
|
-
*/
|
|
419
|
-
interface FeForm {
|
|
420
|
-
sections: FeSection[];
|
|
421
|
-
controls?: FeControlConfig[];
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Runtime state management for form fields
|
|
426
|
-
*/
|
|
427
|
-
type Status = 'VALID' | 'INVALID' | 'PENDING';
|
|
428
|
-
interface FieldState {
|
|
429
|
-
visible: boolean;
|
|
430
|
-
enabled: boolean;
|
|
431
|
-
required: boolean;
|
|
432
|
-
touched: boolean;
|
|
433
|
-
dirty: boolean;
|
|
434
|
-
status: Status;
|
|
435
|
-
errors: Array<{
|
|
436
|
-
code: string;
|
|
437
|
-
message?: string;
|
|
438
|
-
args?: any;
|
|
439
|
-
}>;
|
|
440
|
-
}
|
|
441
|
-
interface RuntimeState {
|
|
442
|
-
fields: Map<string, FieldState>;
|
|
443
|
-
deps: Map<string, Set<string>>;
|
|
444
|
-
}
|
|
445
|
-
interface RuntimeAPI {
|
|
446
|
-
state: RuntimeState;
|
|
447
|
-
ensureFieldState(id: string): FieldState;
|
|
448
|
-
getFieldState(id: string): FieldState | undefined;
|
|
449
|
-
setVisible(id: string, visible: boolean): void;
|
|
450
|
-
setEnabled(id: string, enabled: boolean): void;
|
|
451
|
-
setRequired(id: string, required: boolean): void;
|
|
452
|
-
setTouched(id: string, touched: boolean): void;
|
|
453
|
-
setDirty(id: string, dirty: boolean): void;
|
|
454
|
-
setStatus(id: string, status: Status): void;
|
|
455
|
-
setErrors(id: string, errors: FieldState['errors']): void;
|
|
456
|
-
addDependency(sourceId: string, targetId: string): void;
|
|
457
|
-
getDependents(id: string): Set<string>;
|
|
458
|
-
getDependenciesKeys(): string[];
|
|
459
|
-
}
|
|
460
|
-
declare function createRuntime(): {
|
|
461
|
-
state: RuntimeState;
|
|
462
|
-
api: RuntimeAPI;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Validator registry for sync and async validators
|
|
467
|
-
*/
|
|
468
|
-
interface ValidatorContext {
|
|
469
|
-
get: (path: string) => any;
|
|
470
|
-
signal?: AbortSignal;
|
|
471
|
-
}
|
|
472
|
-
interface ValidationResult {
|
|
473
|
-
valid: boolean;
|
|
474
|
-
error?: {
|
|
475
|
-
code: string;
|
|
476
|
-
message?: string;
|
|
477
|
-
args?: any;
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
type SyncValidator = (value: any, args?: any, ctx?: ValidatorContext) => ValidationResult;
|
|
481
|
-
type AsyncValidator = (value: any, args?: any, ctx?: ValidatorContext) => Promise<ValidationResult>;
|
|
482
|
-
declare function registerValidator(name: string, fn: SyncValidator): void;
|
|
483
|
-
declare function registerAsyncValidator(name: string, fn: AsyncValidator): void;
|
|
484
|
-
declare function getValidator(name: string): SyncValidator | undefined;
|
|
485
|
-
declare function getAsyncValidator(name: string): AsyncValidator | undefined;
|
|
486
|
-
|
|
487
|
-
declare function assertFeForm(x: any): asserts x is FeForm;
|
|
488
|
-
|
|
489
|
-
interface FeFormEngineEvents {
|
|
490
|
-
valueChanges: (values: Record<string, any>) => void;
|
|
491
|
-
statusChanges: (status: {
|
|
492
|
-
valid: boolean;
|
|
493
|
-
errors: Record<string, any>;
|
|
494
|
-
}) => void;
|
|
495
|
-
submit: (values: Record<string, any>) => void;
|
|
496
|
-
fieldStateChanges: (id: string, state: FieldState) => void;
|
|
497
|
-
errorsChanges: (id: string, errors: FieldState['errors']) => void;
|
|
498
|
-
action: <T extends object>(e: {
|
|
499
|
-
controlId: string;
|
|
500
|
-
action: T;
|
|
501
|
-
}) => void;
|
|
502
|
-
}
|
|
503
|
-
interface FeFormEngineState {
|
|
504
|
-
values: Record<string, any>;
|
|
505
|
-
errors: Record<string, any>;
|
|
506
|
-
touched: Record<string, boolean>;
|
|
507
|
-
dirty: Record<string, boolean>;
|
|
508
|
-
valid: boolean;
|
|
509
|
-
}
|
|
510
|
-
interface FeFormEngineOptions {
|
|
511
|
-
initialValues?: Record<string, any>;
|
|
512
|
-
validateOnChange?: boolean;
|
|
513
|
-
}
|
|
514
|
-
interface FeFormEngineResolvers {
|
|
515
|
-
attachment?: <T>(value: T) => Promise<string>;
|
|
516
|
-
objectLatest?: (className: string) => Promise<unknown>;
|
|
517
|
-
}
|
|
518
|
-
declare class FeFormEngine {
|
|
519
|
-
private schema;
|
|
520
|
-
private state;
|
|
521
|
-
private runtime;
|
|
522
|
-
private listeners;
|
|
523
|
-
private batchMode;
|
|
524
|
-
private pendingEmits;
|
|
525
|
-
private pendingValueChanges;
|
|
526
|
-
private pendingFieldStateChanges;
|
|
527
|
-
private pendingErrorsChanges;
|
|
528
|
-
private asyncValidators;
|
|
529
|
-
private conditions;
|
|
530
|
-
readonly resolvers: FeFormEngineResolvers;
|
|
531
|
-
constructor(schema: FeForm, options?: FeFormEngineOptions, resolvers?: FeFormEngineResolvers);
|
|
532
|
-
triggerAction<T extends object>(e: {
|
|
533
|
-
controlId: string;
|
|
534
|
-
action: T;
|
|
535
|
-
}): void;
|
|
536
|
-
private initializeFieldStates;
|
|
537
|
-
private buildDependencyGraph;
|
|
538
|
-
private executeConditions;
|
|
539
|
-
private extractCondition;
|
|
540
|
-
private extractConditionPaths;
|
|
541
|
-
private reevaluateDependents;
|
|
542
|
-
private evaluateFieldConditions;
|
|
543
|
-
private evaluateCondition;
|
|
544
|
-
private emitFieldStateChange;
|
|
545
|
-
private emitErrorsChange;
|
|
546
|
-
private extractInitialValues;
|
|
547
|
-
get values(): {
|
|
548
|
-
get: (id: string, ctx?: {
|
|
549
|
-
index?: number;
|
|
550
|
-
key?: string;
|
|
551
|
-
}) => any;
|
|
552
|
-
set: (id: string, value: any, ctx?: {
|
|
553
|
-
index?: number;
|
|
554
|
-
key?: string;
|
|
555
|
-
}) => void;
|
|
556
|
-
getAll: () => Record<string, any>;
|
|
557
|
-
};
|
|
558
|
-
get status(): {
|
|
559
|
-
valid: boolean;
|
|
560
|
-
errors: Record<string, any>;
|
|
561
|
-
touched: Record<string, boolean>;
|
|
562
|
-
dirty: Record<string, boolean>;
|
|
563
|
-
};
|
|
564
|
-
getFieldState(id: string): FieldState;
|
|
565
|
-
registerValidator(name: string, fn: SyncValidator): void;
|
|
566
|
-
registerAsyncValidator(name: string, fn: AsyncValidator): void;
|
|
567
|
-
batch(fn: () => void): void;
|
|
568
|
-
on<K extends keyof FeFormEngineEvents>(event: K, listener: FeFormEngineEvents[K]): () => void;
|
|
569
|
-
private emit;
|
|
570
|
-
validate(): boolean;
|
|
571
|
-
private validateControlValidator;
|
|
572
|
-
private validateBackend;
|
|
573
|
-
markTouched(id: string): void;
|
|
574
|
-
markAllTouched(): void;
|
|
575
|
-
markAsDirty(id: string): void;
|
|
576
|
-
markAllAsDirty(): void;
|
|
577
|
-
submit(): Record<string, any> | null;
|
|
578
|
-
reset(values?: Record<string, any>): void;
|
|
579
|
-
private traverseSchema;
|
|
580
|
-
private processControl;
|
|
581
|
-
}
|
|
582
|
-
declare function createEngine(schema: FeForm, options?: FeFormEngineOptions, resolvers?: FeFormEngineResolvers): FeFormEngine;
|
|
583
|
-
|
|
584
|
-
export { type AsyncValidator, type FeActivatorConfig, type FeAlignValuesAction, type FeArrayControlConfig, type FeBackendCondition, type FeBackendConditionGroup, type FeBackendSimpleCondition, type FeBackendValidation, type FeBaseControlConfig, type FeBaseFormItemConfig, type FeCondition, type FeControlAction, type FeControlConfig, type FeControlType, type FeControlValidatorConfig, type FeControlValueType, type FeDictControlConfig, type FeDownloadAction, type FeForm, FeFormEngine, type FeFormEngineEvents, type FeFormEngineOptions, type FeFormEngineResolvers, type FeFormEngineState, type FeGroupCondition, type FeGroupControlConfig, type FeGroupValidatorConfig, type FeInvokeAction, type FeMultiSelectControlConfig, type FeNavigateToSectionAction, type FeNumberOperationsControlConfig, type FeNumberSliderControlConfig, type FeObjectControlConfig, type FeOpenUrlAction, type FeScrollTopAction, type FeSection, type FeShowPopupAction, type FeSimpleCondition, type FeSingleSelectControlConfig, type FeTextControlConfig, type FeTextMask, type FeUpdateFormAction, type FeUpdateTableAction, type FeUpdateValueAction, type FieldState, type RuntimeAPI, type RuntimeState, type Status, type SyncValidator, type ValidationResult, type ValidatorContext, assertFeForm, createEngine, createRuntime, getAsyncValidator, getValidator, registerAsyncValidator, registerValidator };
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './types-list';
|
|
3
|
+
export * from './runtime';
|
|
4
|
+
export * from './validators/types';
|
|
5
|
+
export * from './validators/registry';
|
|
6
|
+
export * from './schema-guard';
|
|
7
|
+
export * from './engine';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
|