@ram_28/kf-ai-sdk 1.0.8 → 1.0.10
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/components/hooks/index.d.ts +2 -1
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts +4 -4
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +3 -3
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +7 -4
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +5 -5
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -6
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts +8 -8
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +130 -112
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.mjs +2082 -2067
- package/package.json +1 -1
- package/sdk/components/hooks/index.ts +24 -4
- package/sdk/components/hooks/useForm/apiClient.ts +5 -5
- package/sdk/components/hooks/useForm/expressionValidator.utils.ts +11 -11
- package/sdk/components/hooks/useForm/index.ts +41 -45
- package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +7 -7
- package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +21 -20
- package/sdk/components/hooks/useForm/schemaParser.utils.ts +36 -41
- package/sdk/components/hooks/useForm/types.ts +156 -141
- package/sdk/components/hooks/useForm/useForm.ts +155 -142
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import type { UseFormRegister, Mode, FieldValues as RHFFieldValues,
|
|
1
|
+
import type { UseFormRegister, Mode, FieldValues as RHFFieldValues, FieldErrors, Path, PathValue, RegisterOptions, SetValueConfig, FormState } from "react-hook-form";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* HandleSubmit follows React Hook Form's signature pattern
|
|
4
|
+
*
|
|
5
|
+
* - onSuccess: Called with the API response data on successful submission
|
|
6
|
+
* - onError: Called with either FieldErrors (validation failed) or Error (API failed)
|
|
7
|
+
*
|
|
8
|
+
* Internal flow:
|
|
9
|
+
* 1. RHF validation + Cross-field validation → FAILS → onError(fieldErrors)
|
|
10
|
+
* 2. Clean data & call API → FAILS → onError(apiError)
|
|
11
|
+
* 3. SUCCESS → onSuccess(responseData)
|
|
5
12
|
*/
|
|
6
|
-
export type
|
|
7
|
-
(onValid?: SubmitHandler<T>, onInvalid?: SubmitErrorHandler<T>): (e?: React.BaseSyntheticEvent) => Promise<void>;
|
|
8
|
-
};
|
|
13
|
+
export type HandleSubmit<T extends RHFFieldValues> = (onSuccess?: (data: T, e?: React.BaseSyntheticEvent) => void | Promise<void>, onError?: (error: FieldErrors<T> | Error, e?: React.BaseSyntheticEvent) => void | Promise<void>) => (e?: React.BaseSyntheticEvent) => Promise<void>;
|
|
9
14
|
/**
|
|
10
15
|
* Expression tree node types from backend validation system
|
|
16
|
+
* Used for evaluating validation rules, computed fields, and default values
|
|
11
17
|
*/
|
|
12
18
|
export interface ExpressionTree {
|
|
13
19
|
Type: "BinaryExpression" | "LogicalExpression" | "CallExpression" | "MemberExpression" | "AssignmentExpression" | "SystemIdentifier" | "Identifier" | "Literal";
|
|
@@ -25,9 +31,10 @@ export interface ExpressionTree {
|
|
|
25
31
|
Value?: any;
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
34
|
+
* Validation rule from BDO schema
|
|
35
|
+
* Defines a validation, computation, or business logic rule
|
|
29
36
|
*/
|
|
30
|
-
export interface
|
|
37
|
+
export interface SchemaValidationRule {
|
|
31
38
|
Id: string;
|
|
32
39
|
Name: string;
|
|
33
40
|
Description: string;
|
|
@@ -37,9 +44,9 @@ export interface ValidationRule {
|
|
|
37
44
|
Message?: string;
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
|
-
*
|
|
47
|
+
* Formula definition for computed fields
|
|
41
48
|
*/
|
|
42
|
-
export interface
|
|
49
|
+
export interface ComputedFieldFormula {
|
|
43
50
|
Id?: string;
|
|
44
51
|
Name?: string;
|
|
45
52
|
Description?: string;
|
|
@@ -48,16 +55,16 @@ export interface Formula {
|
|
|
48
55
|
ResultType?: string;
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
|
-
*
|
|
58
|
+
* Default value expression for a field
|
|
52
59
|
*/
|
|
53
|
-
export interface
|
|
60
|
+
export interface DefaultValueExpression {
|
|
54
61
|
Expression: string;
|
|
55
62
|
ExpressionTree: ExpressionTree;
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
|
-
*
|
|
65
|
+
* Reference field configuration for dynamic lookups
|
|
59
66
|
*/
|
|
60
|
-
export interface
|
|
67
|
+
export interface ReferenceFieldConfig {
|
|
61
68
|
Mode: "Dynamic" | "Static";
|
|
62
69
|
Reference?: {
|
|
63
70
|
BusinessObject: string;
|
|
@@ -67,7 +74,7 @@ export interface ReferenceField {
|
|
|
67
74
|
LhsField: string;
|
|
68
75
|
Operator: string;
|
|
69
76
|
RhsType: string;
|
|
70
|
-
RhsValue?:
|
|
77
|
+
RhsValue?: DefaultValueExpression;
|
|
71
78
|
}>;
|
|
72
79
|
};
|
|
73
80
|
Sort?: Array<{
|
|
@@ -77,44 +84,44 @@ export interface ReferenceField {
|
|
|
77
84
|
};
|
|
78
85
|
}
|
|
79
86
|
/**
|
|
80
|
-
*
|
|
87
|
+
* Field options configuration for select/dropdown fields
|
|
81
88
|
*/
|
|
82
|
-
export interface
|
|
89
|
+
export interface FieldOptionsConfig {
|
|
83
90
|
Mode: "Static" | "Dynamic";
|
|
84
91
|
Items?: Array<{
|
|
85
92
|
Value: string | number | boolean;
|
|
86
93
|
Label: string;
|
|
87
94
|
}>;
|
|
88
|
-
Reference?:
|
|
95
|
+
Reference?: ReferenceFieldConfig["Reference"];
|
|
89
96
|
}
|
|
90
97
|
/**
|
|
91
|
-
*
|
|
98
|
+
* BDO field definition structure
|
|
92
99
|
*/
|
|
93
|
-
export interface
|
|
100
|
+
export interface BDOFieldDefinition {
|
|
94
101
|
Id: string;
|
|
95
102
|
Name: string;
|
|
96
103
|
Type: "String" | "Number" | "Boolean" | "Date" | "DateTime" | "Reference" | "Array" | "Object" | "ActivityFlow";
|
|
97
104
|
Required?: boolean;
|
|
98
105
|
Unique?: boolean;
|
|
99
|
-
DefaultValue?:
|
|
100
|
-
Formula?:
|
|
106
|
+
DefaultValue?: DefaultValueExpression;
|
|
107
|
+
Formula?: ComputedFieldFormula;
|
|
101
108
|
Computed?: boolean;
|
|
102
|
-
Validation?: string[] |
|
|
103
|
-
Values?:
|
|
109
|
+
Validation?: string[] | SchemaValidationRule[];
|
|
110
|
+
Values?: FieldOptionsConfig;
|
|
104
111
|
Items?: {
|
|
105
112
|
Type: string;
|
|
106
|
-
Property?: Record<string,
|
|
113
|
+
Property?: Record<string, BDOFieldDefinition>;
|
|
107
114
|
};
|
|
108
|
-
Property?: Record<string,
|
|
115
|
+
Property?: Record<string, BDOFieldDefinition>;
|
|
109
116
|
Description?: string;
|
|
110
117
|
}
|
|
111
118
|
/**
|
|
112
119
|
* Business Object Rule definitions from BDO schema
|
|
113
120
|
*/
|
|
114
121
|
export interface BusinessObjectRules {
|
|
115
|
-
Computation?: Record<string,
|
|
116
|
-
Validation?: Record<string,
|
|
117
|
-
BusinessLogic?: Record<string,
|
|
122
|
+
Computation?: Record<string, SchemaValidationRule>;
|
|
123
|
+
Validation?: Record<string, SchemaValidationRule>;
|
|
124
|
+
BusinessLogic?: Record<string, SchemaValidationRule>;
|
|
118
125
|
}
|
|
119
126
|
/**
|
|
120
127
|
* Role permission definition from BDO schema
|
|
@@ -134,7 +141,7 @@ export interface RolePermission {
|
|
|
134
141
|
};
|
|
135
142
|
}
|
|
136
143
|
/**
|
|
137
|
-
* Complete BDO
|
|
144
|
+
* Complete BDO (Business Data Object) schema structure
|
|
138
145
|
*/
|
|
139
146
|
export interface BDOSchema {
|
|
140
147
|
Id: string;
|
|
@@ -142,19 +149,13 @@ export interface BDOSchema {
|
|
|
142
149
|
Kind: "BusinessObject";
|
|
143
150
|
Description: string;
|
|
144
151
|
Rules: BusinessObjectRules;
|
|
145
|
-
Fields: Record<string,
|
|
152
|
+
Fields: Record<string, BDOFieldDefinition>;
|
|
146
153
|
RolePermission: Record<string, RolePermission>;
|
|
147
154
|
Roles: Record<string, {
|
|
148
155
|
Name: string;
|
|
149
156
|
Description: string;
|
|
150
157
|
}>;
|
|
151
158
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Complete backend schema response structure (legacy support)
|
|
154
|
-
*/
|
|
155
|
-
export interface BackendSchema {
|
|
156
|
-
[fieldName: string]: BackendFieldDefinition;
|
|
157
|
-
}
|
|
158
159
|
/**
|
|
159
160
|
* Form operation mode
|
|
160
161
|
*/
|
|
@@ -167,17 +168,6 @@ export type FormMode = Mode;
|
|
|
167
168
|
* Rule classification types
|
|
168
169
|
*/
|
|
169
170
|
export type RuleType = "Validation" | "Computation" | "BusinessLogic";
|
|
170
|
-
/**
|
|
171
|
-
* Rule execution context
|
|
172
|
-
*/
|
|
173
|
-
export interface RuleExecutionContext<T> {
|
|
174
|
-
ruleType: RuleType;
|
|
175
|
-
ruleId: string;
|
|
176
|
-
fieldName: keyof T;
|
|
177
|
-
fieldValue: any;
|
|
178
|
-
formValues: Partial<T>;
|
|
179
|
-
rule: ValidationRule;
|
|
180
|
-
}
|
|
181
171
|
/**
|
|
182
172
|
* useForm hook options with strict typing
|
|
183
173
|
*/
|
|
@@ -212,20 +202,12 @@ export interface UseFormOptions<T extends Record<string, any> = Record<string, a
|
|
|
212
202
|
enabled?: boolean;
|
|
213
203
|
/** User role for permission enforcement */
|
|
214
204
|
userRole?: string;
|
|
215
|
-
/**
|
|
216
|
-
onSuccess?: (data: T) => void;
|
|
217
|
-
/** Error callback */
|
|
218
|
-
onError?: (error: Error) => void;
|
|
219
|
-
/** Schema load error callback */
|
|
205
|
+
/** Schema load error callback (separate concern from form submission) */
|
|
220
206
|
onSchemaError?: (error: Error) => void;
|
|
221
|
-
/** Submit error callback */
|
|
222
|
-
onSubmitError?: (error: Error) => void;
|
|
223
|
-
/** Computation rule callback (called when computation rules are triggered) */
|
|
224
|
-
onComputationRule?: (context: RuleExecutionContext<T>) => Promise<Partial<T>>;
|
|
225
207
|
/** Skip schema fetching (use for testing) */
|
|
226
208
|
skipSchemaFetch?: boolean;
|
|
227
209
|
/** Manual schema (use instead of fetching) */
|
|
228
|
-
schema?:
|
|
210
|
+
schema?: BDOSchema;
|
|
229
211
|
/**
|
|
230
212
|
* Trigger draft API call on every field change (after validation passes)
|
|
231
213
|
* If true: draft API is called for any field change
|
|
@@ -245,67 +227,77 @@ export interface FieldPermission {
|
|
|
245
227
|
hidden: boolean;
|
|
246
228
|
}
|
|
247
229
|
/**
|
|
248
|
-
*
|
|
230
|
+
* Field input types for form rendering
|
|
231
|
+
*/
|
|
232
|
+
export type FormFieldType = "text" | "number" | "email" | "password" | "date" | "datetime-local" | "checkbox" | "select" | "textarea" | "reference";
|
|
233
|
+
/**
|
|
234
|
+
* Select option for dropdown fields
|
|
235
|
+
*/
|
|
236
|
+
export interface SelectOption {
|
|
237
|
+
value: any;
|
|
238
|
+
label: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Field rule IDs by category
|
|
249
242
|
*/
|
|
250
|
-
export interface
|
|
251
|
-
|
|
243
|
+
export interface FieldRuleIds {
|
|
244
|
+
validation: string[];
|
|
245
|
+
computation: string[];
|
|
246
|
+
businessLogic: string[];
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Form field configuration for rendering
|
|
250
|
+
* Contains all metadata needed to render and validate a form field
|
|
251
|
+
*/
|
|
252
|
+
export interface FormFieldConfig {
|
|
253
|
+
/** Field name/identifier */
|
|
252
254
|
name: string;
|
|
253
|
-
/** Field type */
|
|
254
|
-
type:
|
|
255
|
-
/**
|
|
255
|
+
/** Field input type */
|
|
256
|
+
type: FormFieldType;
|
|
257
|
+
/** Display label */
|
|
256
258
|
label: string;
|
|
257
259
|
/** Whether field is required */
|
|
258
260
|
required: boolean;
|
|
259
|
-
/** Whether field is computed (read-only) */
|
|
261
|
+
/** Whether field is computed (read-only, auto-calculated) */
|
|
260
262
|
computed: boolean;
|
|
261
263
|
/** Default value */
|
|
262
264
|
defaultValue?: any;
|
|
263
265
|
/** Select options (for select/reference fields) */
|
|
264
|
-
options?:
|
|
265
|
-
|
|
266
|
-
label: string;
|
|
267
|
-
}>;
|
|
268
|
-
/** Validation rules */
|
|
266
|
+
options?: SelectOption[];
|
|
267
|
+
/** Validation configuration */
|
|
269
268
|
validation: any;
|
|
270
269
|
/** Field description/help text */
|
|
271
270
|
description?: string;
|
|
272
|
-
/**
|
|
273
|
-
|
|
271
|
+
/** Original BDO field definition (for advanced use) */
|
|
272
|
+
_bdoField: BDOFieldDefinition;
|
|
274
273
|
/** Field permissions for current user */
|
|
275
274
|
permission: FieldPermission;
|
|
276
|
-
/**
|
|
277
|
-
rules:
|
|
278
|
-
validation: string[];
|
|
279
|
-
computation: string[];
|
|
280
|
-
businessLogic: string[];
|
|
281
|
-
};
|
|
275
|
+
/** Associated rule IDs by category */
|
|
276
|
+
rules: FieldRuleIds;
|
|
282
277
|
}
|
|
283
278
|
/**
|
|
284
|
-
* Form schema after processing
|
|
279
|
+
* Form schema configuration after processing
|
|
280
|
+
* Contains all fields and rules ready for form rendering
|
|
285
281
|
*/
|
|
286
|
-
export interface
|
|
287
|
-
/** All fields */
|
|
288
|
-
fields: Record<string,
|
|
289
|
-
/** Field names in order */
|
|
282
|
+
export interface FormSchemaConfig {
|
|
283
|
+
/** All fields by name */
|
|
284
|
+
fields: Record<string, FormFieldConfig>;
|
|
285
|
+
/** Field names in display order */
|
|
290
286
|
fieldOrder: string[];
|
|
291
|
-
/**
|
|
287
|
+
/** Names of computed fields */
|
|
292
288
|
computedFields: string[];
|
|
293
|
-
/**
|
|
289
|
+
/** Names of required fields */
|
|
294
290
|
requiredFields: string[];
|
|
295
291
|
/** Cross-field validation rules */
|
|
296
|
-
crossFieldValidation:
|
|
292
|
+
crossFieldValidation: SchemaValidationRule[];
|
|
297
293
|
/** Classified rules by type */
|
|
298
294
|
rules: {
|
|
299
|
-
validation: Record<string,
|
|
300
|
-
computation: Record<string,
|
|
301
|
-
businessLogic: Record<string,
|
|
295
|
+
validation: Record<string, SchemaValidationRule>;
|
|
296
|
+
computation: Record<string, SchemaValidationRule>;
|
|
297
|
+
businessLogic: Record<string, SchemaValidationRule>;
|
|
302
298
|
};
|
|
303
299
|
/** Field-to-rule mapping for quick lookup */
|
|
304
|
-
fieldRules: Record<string,
|
|
305
|
-
validation: string[];
|
|
306
|
-
computation: string[];
|
|
307
|
-
businessLogic: string[];
|
|
308
|
-
}>;
|
|
300
|
+
fieldRules: Record<string, FieldRuleIds>;
|
|
309
301
|
/** Role permissions */
|
|
310
302
|
rolePermissions?: Record<string, RolePermission>;
|
|
311
303
|
}
|
|
@@ -315,8 +307,38 @@ export interface ProcessedSchema {
|
|
|
315
307
|
export interface UseFormReturn<T extends Record<string, any> = Record<string, any>> {
|
|
316
308
|
/** Register field for validation and form handling with strict typing */
|
|
317
309
|
register: <K extends Path<T>>(name: K, options?: RegisterOptions<T, K>) => ReturnType<UseFormRegister<T>>;
|
|
318
|
-
/**
|
|
319
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Handle form submission with optional callbacks
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* // Basic usage - no callbacks
|
|
315
|
+
* <form onSubmit={form.handleSubmit()}>
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* // With success callback
|
|
319
|
+
* <form onSubmit={form.handleSubmit((data) => {
|
|
320
|
+
* toast.success("Saved!");
|
|
321
|
+
* navigate("/products/" + data._id);
|
|
322
|
+
* })}>
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* // With both callbacks
|
|
326
|
+
* <form onSubmit={form.handleSubmit(
|
|
327
|
+
* (data) => toast.success("Saved!"),
|
|
328
|
+
* (error) => {
|
|
329
|
+
* if (error instanceof Error) {
|
|
330
|
+
* toast.error(error.message); // API error
|
|
331
|
+
* } else {
|
|
332
|
+
* toast.error("Please fix the form errors"); // Validation errors
|
|
333
|
+
* }
|
|
334
|
+
* }
|
|
335
|
+
* )}>
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* // Programmatic submission
|
|
339
|
+
* await form.handleSubmit(onSuccess, onError)();
|
|
340
|
+
*/
|
|
341
|
+
handleSubmit: HandleSubmit<T>;
|
|
320
342
|
/** Watch field values with strict typing */
|
|
321
343
|
watch: <K extends Path<T> | readonly Path<T>[]>(name?: K) => K extends Path<T> ? PathValue<T, K> : K extends readonly Path<T>[] ? PathValue<T, K[number]>[] : T;
|
|
322
344
|
/** Set field value programmatically with strict typing */
|
|
@@ -343,30 +365,26 @@ export interface UseFormReturn<T extends Record<string, any> = Record<string, an
|
|
|
343
365
|
isLoading: boolean;
|
|
344
366
|
/** Schema fetch error */
|
|
345
367
|
loadError: Error | null;
|
|
346
|
-
/** Form submission error */
|
|
347
|
-
submitError: Error | null;
|
|
348
368
|
/** Any error active */
|
|
349
369
|
hasError: boolean;
|
|
350
|
-
/** Raw
|
|
351
|
-
schema:
|
|
352
|
-
/** Processed schema for rendering */
|
|
353
|
-
|
|
370
|
+
/** Raw BDO schema */
|
|
371
|
+
schema: BDOSchema | null;
|
|
372
|
+
/** Processed schema configuration for rendering */
|
|
373
|
+
schemaConfig: FormSchemaConfig | null;
|
|
354
374
|
/** Computed field names as typed array */
|
|
355
375
|
computedFields: Array<keyof T>;
|
|
356
376
|
/** Required field names as typed array */
|
|
357
377
|
requiredFields: Array<keyof T>;
|
|
358
|
-
/** Get field
|
|
359
|
-
getField: <K extends keyof T>(fieldName: K) =>
|
|
360
|
-
/** Get all
|
|
361
|
-
getFields: () => Record<keyof T,
|
|
378
|
+
/** Get field configuration with strict typing */
|
|
379
|
+
getField: <K extends keyof T>(fieldName: K) => FormFieldConfig | null;
|
|
380
|
+
/** Get all field configurations with strict typing */
|
|
381
|
+
getFields: () => Record<keyof T, FormFieldConfig>;
|
|
362
382
|
/** Check if field exists with strict typing */
|
|
363
383
|
hasField: <K extends keyof T>(fieldName: K) => boolean;
|
|
364
384
|
/** Check if field is required with strict typing */
|
|
365
385
|
isFieldRequired: <K extends keyof T>(fieldName: K) => boolean;
|
|
366
386
|
/** Check if field is computed with strict typing */
|
|
367
387
|
isFieldComputed: <K extends keyof T>(fieldName: K) => boolean;
|
|
368
|
-
/** Submit form manually */
|
|
369
|
-
submit: () => Promise<void>;
|
|
370
388
|
/** Refresh schema */
|
|
371
389
|
refreshSchema: () => Promise<void>;
|
|
372
390
|
/** Validate form manually */
|
|
@@ -375,9 +393,9 @@ export interface UseFormReturn<T extends Record<string, any> = Record<string, an
|
|
|
375
393
|
clearErrors: () => void;
|
|
376
394
|
}
|
|
377
395
|
/**
|
|
378
|
-
* Expression evaluation context
|
|
396
|
+
* Expression evaluation context
|
|
379
397
|
*/
|
|
380
|
-
export interface
|
|
398
|
+
export interface ExpressionContext<T = Record<string, any>> {
|
|
381
399
|
/** Current form values */
|
|
382
400
|
formValues: Partial<T>;
|
|
383
401
|
/** System values (NOW, TODAY, CURRENT_USER, etc.) */
|
|
@@ -386,9 +404,9 @@ export interface EvaluationContext<T = Record<string, any>> {
|
|
|
386
404
|
referenceData: Record<string, any[]>;
|
|
387
405
|
}
|
|
388
406
|
/**
|
|
389
|
-
*
|
|
407
|
+
* Field validation result
|
|
390
408
|
*/
|
|
391
|
-
export interface
|
|
409
|
+
export interface FieldValidationResult<T = Record<string, any>> {
|
|
392
410
|
/** Is validation passing */
|
|
393
411
|
isValid: boolean;
|
|
394
412
|
/** Error message if validation fails */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,eAAe,EACf,IAAI,EACJ,WAAW,IAAI,cAAc,EAC7B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,eAAe,EACf,IAAI,EACJ,WAAW,IAAI,cAAc,EAC7B,WAAW,EACX,IAAI,EACJ,SAAS,EACT,eAAe,EACf,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAC;AAMzB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,cAAc,IAAI,CACnD,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC3E,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,EAC7B,CAAC,CAAC,EAAE,KAAK,CAAC,kBAAkB,KACzB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KACtB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAMrD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EACA,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB,YAAY,GACZ,SAAS,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAA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AAK,CAAC,EAAE,KAAK,CAAC;IAEd,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/useForm.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAId,MAAM,SAAS,CAAC;AAwBjB,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GACzB,aAAa,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/useForm.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAId,MAAM,SAAS,CAAC;AAwBjB,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GACzB,aAAa,CAAC,CAAC,CAAC,CAuxBlB"}
|