@ram_28/kf-ai-sdk 1.0.10 → 1.0.12
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 +55 -48
- package/dist/api/client.d.ts +23 -13
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/datetime.d.ts +5 -5
- package/dist/api/datetime.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +2 -2
- package/dist/api/metadata.d.ts.map +1 -1
- package/dist/api.cjs +1 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.mjs +27 -0
- package/dist/api.types.cjs +1 -0
- package/dist/api.types.d.ts +4 -0
- package/dist/api.types.d.ts.map +1 -0
- package/dist/api.types.mjs +1 -0
- package/dist/auth/AuthProvider.d.ts +3 -3
- package/dist/auth/AuthProvider.d.ts.map +1 -1
- package/dist/auth/authClient.d.ts +4 -4
- package/dist/auth/authClient.d.ts.map +1 -1
- package/dist/auth/authConfig.d.ts +5 -5
- package/dist/auth/authConfig.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/types.d.ts +21 -21
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/useAuth.d.ts +2 -2
- package/dist/auth/useAuth.d.ts.map +1 -1
- package/dist/auth.cjs +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.mjs +280 -0
- package/dist/auth.types.cjs +1 -0
- package/dist/auth.types.d.ts +2 -0
- package/dist/auth.types.d.ts.map +1 -0
- package/dist/auth.types.mjs +1 -0
- package/dist/base-types.d.ts +2 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/client-C15j4O5B.cjs +1 -0
- package/dist/client-CfvLiGfP.js +233 -0
- package/dist/cn-Dr87sK3i.js +2775 -0
- package/dist/cn-mXUIg4vp.cjs +1 -0
- package/dist/components/hooks/index.d.ts +3 -3
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/index.d.ts +2 -2
- package/dist/components/hooks/useFilter/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/types.d.ts +19 -31
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +2 -2
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts +6 -6
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +5 -5
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +10 -10
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -12
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +79 -70
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +2 -2
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/apiClient.d.ts +16 -16
- package/dist/components/hooks/useKanban/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +3 -3
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/dragDropManager.d.ts +7 -7
- package/dist/components/hooks/useKanban/dragDropManager.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/index.d.ts +1 -1
- package/dist/components/hooks/useKanban/index.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +65 -67
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts +2 -2
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/index.d.ts +1 -1
- package/dist/components/hooks/useTable/index.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +10 -10
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts +2 -2
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/filter.cjs +1 -0
- package/dist/filter.d.ts +3 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.mjs +6 -0
- package/dist/filter.types.cjs +1 -0
- package/dist/filter.types.d.ts +2 -0
- package/dist/filter.types.d.ts.map +1 -0
- package/dist/filter.types.mjs +1 -0
- package/dist/form.cjs +1 -0
- package/dist/form.d.ts +3 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.mjs +1346 -0
- package/dist/form.types.cjs +1 -0
- package/dist/form.types.d.ts +2 -0
- package/dist/form.types.d.ts.map +1 -0
- package/dist/form.types.mjs +1 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/kanban.cjs +13 -0
- package/dist/kanban.d.ts +5 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.mjs +694 -0
- package/dist/kanban.types.cjs +1 -0
- package/dist/kanban.types.d.ts +2 -0
- package/dist/kanban.types.d.ts.map +1 -0
- package/dist/kanban.types.mjs +1 -0
- package/dist/kanban.ui.cjs +1 -0
- package/dist/kanban.ui.d.ts +2 -0
- package/dist/kanban.ui.d.ts.map +1 -0
- package/dist/kanban.ui.mjs +104 -0
- package/dist/metadata-2FLBsFcf.cjs +1 -0
- package/dist/metadata-DBcoDth-.js +43 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.mjs +148 -0
- package/dist/table.types.cjs +1 -0
- package/dist/table.types.d.ts +2 -0
- package/dist/table.types.d.ts.map +1 -0
- package/dist/table.types.mjs +1 -0
- package/dist/types/base-fields.d.ts +45 -45
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/common.d.ts +45 -61
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.mjs +1 -0
- package/dist/useFilter-CXFqEHyI.js +129 -0
- package/dist/useFilter-D-bCDo6Z.cjs +1 -0
- package/dist/utils/formatting.d.ts +4 -4
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.mjs +105 -0
- package/package.json +147 -9
- package/sdk/api/client.ts +76 -49
- package/sdk/api/datetime.ts +5 -5
- package/sdk/api/index.ts +28 -33
- package/sdk/api/metadata.ts +4 -4
- package/sdk/api.ts +24 -0
- package/sdk/api.types.ts +58 -0
- package/sdk/auth/AuthProvider.tsx +18 -18
- package/sdk/auth/authClient.ts +9 -9
- package/sdk/auth/authConfig.ts +9 -9
- package/sdk/auth/index.ts +5 -5
- package/sdk/auth/types.ts +21 -21
- package/sdk/auth/useAuth.ts +2 -2
- package/sdk/auth.ts +22 -0
- package/sdk/auth.types.ts +28 -0
- package/sdk/base-types.ts +45 -0
- package/sdk/components/hooks/index.ts +22 -22
- package/sdk/components/hooks/useFilter/index.ts +8 -14
- package/sdk/components/hooks/useFilter/types.ts +29 -58
- package/sdk/components/hooks/useFilter/useFilter.ts +41 -44
- package/sdk/components/hooks/useForm/apiClient.ts +8 -8
- package/sdk/components/hooks/useForm/expressionValidator.utils.ts +18 -18
- package/sdk/components/hooks/useForm/index.ts +24 -24
- package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +22 -22
- package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +26 -62
- package/sdk/components/hooks/useForm/schemaParser.utils.ts +24 -24
- package/sdk/components/hooks/useForm/types.ts +85 -75
- package/sdk/components/hooks/useForm/useForm.ts +160 -40
- package/sdk/components/hooks/useKanban/apiClient.ts +54 -54
- package/sdk/components/hooks/useKanban/context.ts +3 -3
- package/sdk/components/hooks/useKanban/dragDropManager.ts +19 -19
- package/sdk/components/hooks/useKanban/index.ts +26 -26
- package/sdk/components/hooks/useKanban/types.ts +69 -71
- package/sdk/components/hooks/useKanban/useKanban.ts +43 -51
- package/sdk/components/hooks/useKanban/useKanbanSimple.ts +4 -4
- package/sdk/components/hooks/useTable/index.ts +5 -1
- package/sdk/components/hooks/useTable/types.ts +10 -10
- package/sdk/components/hooks/useTable/useTable.ts +10 -10
- package/sdk/filter.ts +13 -0
- package/sdk/filter.types.ts +17 -0
- package/sdk/form.ts +15 -0
- package/sdk/form.types.ts +46 -0
- package/sdk/kanban.ts +23 -0
- package/sdk/kanban.types.ts +50 -0
- package/sdk/kanban.ui.ts +16 -0
- package/sdk/table.ts +7 -0
- package/sdk/table.types.ts +13 -0
- package/sdk/types/base-fields.ts +47 -47
- package/sdk/types/common.ts +47 -71
- package/sdk/types/index.ts +1 -1
- package/sdk/utils/formatting.ts +4 -4
- package/sdk/utils.ts +10 -0
- package/dist/index.cjs +0 -45
- package/dist/index.mjs +0 -6327
|
@@ -11,7 +11,6 @@ import type {
|
|
|
11
11
|
PathValue,
|
|
12
12
|
RegisterOptions,
|
|
13
13
|
SetValueConfig,
|
|
14
|
-
FormState,
|
|
15
14
|
} from "react-hook-form";
|
|
16
15
|
|
|
17
16
|
// ============================================================
|
|
@@ -29,7 +28,7 @@ import type {
|
|
|
29
28
|
* 2. Clean data & call API → FAILS → onError(apiError)
|
|
30
29
|
* 3. SUCCESS → onSuccess(responseData)
|
|
31
30
|
*/
|
|
32
|
-
export type
|
|
31
|
+
export type HandleSubmitType<T extends RHFFieldValues> = (
|
|
33
32
|
onSuccess?: (data: T, e?: React.BaseSyntheticEvent) => void | Promise<void>,
|
|
34
33
|
onError?: (
|
|
35
34
|
error: FieldErrors<T> | Error,
|
|
@@ -45,7 +44,7 @@ export type HandleSubmit<T extends RHFFieldValues> = (
|
|
|
45
44
|
* Expression tree node types from backend validation system
|
|
46
45
|
* Used for evaluating validation rules, computed fields, and default values
|
|
47
46
|
*/
|
|
48
|
-
export interface
|
|
47
|
+
export interface ExpressionTreeType {
|
|
49
48
|
Type:
|
|
50
49
|
| "BinaryExpression"
|
|
51
50
|
| "LogicalExpression"
|
|
@@ -57,7 +56,7 @@ export interface ExpressionTree {
|
|
|
57
56
|
| "Literal";
|
|
58
57
|
Operator?: string;
|
|
59
58
|
Callee?: string;
|
|
60
|
-
Arguments?:
|
|
59
|
+
Arguments?: ExpressionTreeType[];
|
|
61
60
|
Name?: string;
|
|
62
61
|
Source?: string;
|
|
63
62
|
Property?: {
|
|
@@ -77,12 +76,12 @@ export interface ExpressionTree {
|
|
|
77
76
|
* Validation rule from BDO schema
|
|
78
77
|
* Defines a validation, computation, or business logic rule
|
|
79
78
|
*/
|
|
80
|
-
export interface
|
|
79
|
+
export interface SchemaValidationRuleType {
|
|
81
80
|
Id: string;
|
|
82
81
|
Name: string;
|
|
83
82
|
Description: string;
|
|
84
83
|
Expression: string;
|
|
85
|
-
ExpressionTree:
|
|
84
|
+
ExpressionTree: ExpressionTreeType;
|
|
86
85
|
ResultType: string;
|
|
87
86
|
Message?: string;
|
|
88
87
|
}
|
|
@@ -90,27 +89,27 @@ export interface SchemaValidationRule {
|
|
|
90
89
|
/**
|
|
91
90
|
* Formula definition for computed fields
|
|
92
91
|
*/
|
|
93
|
-
export interface
|
|
92
|
+
export interface ComputedFieldFormulaType {
|
|
94
93
|
Id?: string;
|
|
95
94
|
Name?: string;
|
|
96
95
|
Description?: string;
|
|
97
96
|
Expression: string;
|
|
98
|
-
ExpressionTree:
|
|
97
|
+
ExpressionTree: ExpressionTreeType;
|
|
99
98
|
ResultType?: string;
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
/**
|
|
103
102
|
* Default value expression for a field
|
|
104
103
|
*/
|
|
105
|
-
export interface
|
|
104
|
+
export interface DefaultValueExpressionType {
|
|
106
105
|
Expression: string;
|
|
107
|
-
ExpressionTree:
|
|
106
|
+
ExpressionTree: ExpressionTreeType;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
/**
|
|
111
110
|
* Reference field configuration for dynamic lookups
|
|
112
111
|
*/
|
|
113
|
-
export interface
|
|
112
|
+
export interface ReferenceFieldConfigType {
|
|
114
113
|
Mode: "Dynamic" | "Static";
|
|
115
114
|
Reference?: {
|
|
116
115
|
BusinessObject: string;
|
|
@@ -120,7 +119,7 @@ export interface ReferenceFieldConfig {
|
|
|
120
119
|
LhsField: string;
|
|
121
120
|
Operator: string;
|
|
122
121
|
RhsType: string;
|
|
123
|
-
RhsValue?:
|
|
122
|
+
RhsValue?: DefaultValueExpressionType;
|
|
124
123
|
}>;
|
|
125
124
|
};
|
|
126
125
|
Sort?: Array<{
|
|
@@ -133,19 +132,19 @@ export interface ReferenceFieldConfig {
|
|
|
133
132
|
/**
|
|
134
133
|
* Field options configuration for select/dropdown fields
|
|
135
134
|
*/
|
|
136
|
-
export interface
|
|
135
|
+
export interface FieldOptionsConfigType {
|
|
137
136
|
Mode: "Static" | "Dynamic";
|
|
138
137
|
Items?: Array<{
|
|
139
138
|
Value: string | number | boolean;
|
|
140
139
|
Label: string;
|
|
141
140
|
}>;
|
|
142
|
-
Reference?:
|
|
141
|
+
Reference?: ReferenceFieldConfigType["Reference"];
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
/**
|
|
146
145
|
* BDO field definition structure
|
|
147
146
|
*/
|
|
148
|
-
export interface
|
|
147
|
+
export interface BDOFieldDefinitionType {
|
|
149
148
|
Id: string;
|
|
150
149
|
Name: string;
|
|
151
150
|
Type:
|
|
@@ -160,32 +159,32 @@ export interface BDOFieldDefinition {
|
|
|
160
159
|
| "ActivityFlow";
|
|
161
160
|
Required?: boolean;
|
|
162
161
|
Unique?: boolean;
|
|
163
|
-
DefaultValue?:
|
|
164
|
-
Formula?:
|
|
162
|
+
DefaultValue?: DefaultValueExpressionType;
|
|
163
|
+
Formula?: ComputedFieldFormulaType;
|
|
165
164
|
Computed?: boolean;
|
|
166
|
-
Validation?: string[] |
|
|
167
|
-
Values?:
|
|
165
|
+
Validation?: string[] | SchemaValidationRuleType[]; // Array of rule IDs OR inline validation rule objects
|
|
166
|
+
Values?: FieldOptionsConfigType;
|
|
168
167
|
Items?: {
|
|
169
168
|
Type: string;
|
|
170
|
-
Property?: Record<string,
|
|
169
|
+
Property?: Record<string, BDOFieldDefinitionType>;
|
|
171
170
|
};
|
|
172
|
-
Property?: Record<string,
|
|
171
|
+
Property?: Record<string, BDOFieldDefinitionType>;
|
|
173
172
|
Description?: string;
|
|
174
173
|
}
|
|
175
174
|
|
|
176
175
|
/**
|
|
177
176
|
* Business Object Rule definitions from BDO schema
|
|
178
177
|
*/
|
|
179
|
-
export interface
|
|
180
|
-
Computation?: Record<string,
|
|
181
|
-
Validation?: Record<string,
|
|
182
|
-
BusinessLogic?: Record<string,
|
|
178
|
+
export interface BusinessObjectRulesType {
|
|
179
|
+
Computation?: Record<string, SchemaValidationRuleType>;
|
|
180
|
+
Validation?: Record<string, SchemaValidationRuleType>;
|
|
181
|
+
BusinessLogic?: Record<string, SchemaValidationRuleType>;
|
|
183
182
|
}
|
|
184
183
|
|
|
185
184
|
/**
|
|
186
185
|
* Role permission definition from BDO schema
|
|
187
186
|
*/
|
|
188
|
-
export interface
|
|
187
|
+
export interface RolePermissionType {
|
|
189
188
|
Editable?: string[];
|
|
190
189
|
ReadOnly?: string[];
|
|
191
190
|
Methods?: string[];
|
|
@@ -203,14 +202,14 @@ export interface RolePermission {
|
|
|
203
202
|
/**
|
|
204
203
|
* Complete BDO (Business Data Object) schema structure
|
|
205
204
|
*/
|
|
206
|
-
export interface
|
|
205
|
+
export interface BDOSchemaType {
|
|
207
206
|
Id: string;
|
|
208
207
|
Name: string;
|
|
209
208
|
Kind: "BusinessObject";
|
|
210
209
|
Description: string;
|
|
211
|
-
Rules:
|
|
212
|
-
Fields: Record<string,
|
|
213
|
-
RolePermission: Record<string,
|
|
210
|
+
Rules: BusinessObjectRulesType;
|
|
211
|
+
Fields: Record<string, BDOFieldDefinitionType>;
|
|
212
|
+
RolePermission: Record<string, RolePermissionType>;
|
|
214
213
|
Roles: Record<
|
|
215
214
|
string,
|
|
216
215
|
{
|
|
@@ -227,29 +226,36 @@ export interface BDOSchema {
|
|
|
227
226
|
/**
|
|
228
227
|
* Form operation mode
|
|
229
228
|
*/
|
|
230
|
-
export type
|
|
229
|
+
export type FormOperationType = "create" | "update";
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Form interaction mode
|
|
233
|
+
* - "interactive" (default): Real-time server-side validation and computation on every field blur
|
|
234
|
+
* - "non-interactive": Draft only for computed field dependencies (legacy behavior)
|
|
235
|
+
*/
|
|
236
|
+
export type InteractionModeType = "interactive" | "non-interactive";
|
|
231
237
|
|
|
232
238
|
/**
|
|
233
239
|
* Form validation mode (from react-hook-form)
|
|
234
240
|
*/
|
|
235
|
-
export type
|
|
241
|
+
export type FormModeType = Mode;
|
|
236
242
|
|
|
237
243
|
/**
|
|
238
244
|
* Rule classification types
|
|
239
245
|
*/
|
|
240
|
-
export type
|
|
246
|
+
export type RuleTypeType = "Validation" | "Computation" | "BusinessLogic";
|
|
241
247
|
|
|
242
248
|
/**
|
|
243
249
|
* useForm hook options with strict typing
|
|
244
250
|
*/
|
|
245
|
-
export interface
|
|
251
|
+
export interface UseFormOptionsType<
|
|
246
252
|
T extends Record<string, any> = Record<string, any>,
|
|
247
253
|
> {
|
|
248
254
|
/** Data source identifier (Business Object name) */
|
|
249
255
|
source: string;
|
|
250
256
|
|
|
251
257
|
/** Form operation type */
|
|
252
|
-
operation:
|
|
258
|
+
operation: FormOperationType;
|
|
253
259
|
|
|
254
260
|
/** Record ID for update operations */
|
|
255
261
|
recordId?: string;
|
|
@@ -274,7 +280,7 @@ export interface UseFormOptions<
|
|
|
274
280
|
* @default "onBlur"
|
|
275
281
|
* @see https://react-hook-form.com/docs/useform for more details on validation modes
|
|
276
282
|
*/
|
|
277
|
-
mode?:
|
|
283
|
+
mode?: FormModeType;
|
|
278
284
|
|
|
279
285
|
/** Whether to enable schema fetching and form initialization (default: true) */
|
|
280
286
|
enabled?: boolean;
|
|
@@ -289,14 +295,15 @@ export interface UseFormOptions<
|
|
|
289
295
|
skipSchemaFetch?: boolean;
|
|
290
296
|
|
|
291
297
|
/** Manual schema (use instead of fetching) */
|
|
292
|
-
schema?:
|
|
298
|
+
schema?: BDOSchemaType;
|
|
293
299
|
|
|
294
300
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
301
|
+
* Form interaction mode
|
|
302
|
+
* - "interactive" (default): Real-time server-side validation and computation on every field blur
|
|
303
|
+
* - "non-interactive": Draft only for computed field dependencies
|
|
304
|
+
* @default "interactive"
|
|
298
305
|
*/
|
|
299
|
-
|
|
306
|
+
interactionMode?: InteractionModeType;
|
|
300
307
|
}
|
|
301
308
|
|
|
302
309
|
// ============================================================
|
|
@@ -306,7 +313,7 @@ export interface UseFormOptions<
|
|
|
306
313
|
/**
|
|
307
314
|
* Field permission for current user
|
|
308
315
|
*/
|
|
309
|
-
export interface
|
|
316
|
+
export interface FieldPermissionType {
|
|
310
317
|
/** Can user edit this field */
|
|
311
318
|
editable: boolean;
|
|
312
319
|
|
|
@@ -320,7 +327,7 @@ export interface FieldPermission {
|
|
|
320
327
|
/**
|
|
321
328
|
* Field input types for form rendering
|
|
322
329
|
*/
|
|
323
|
-
export type
|
|
330
|
+
export type FormFieldTypeType =
|
|
324
331
|
| "text"
|
|
325
332
|
| "number"
|
|
326
333
|
| "email"
|
|
@@ -335,7 +342,7 @@ export type FormFieldType =
|
|
|
335
342
|
/**
|
|
336
343
|
* Select option for dropdown fields
|
|
337
344
|
*/
|
|
338
|
-
export interface
|
|
345
|
+
export interface SelectOptionType {
|
|
339
346
|
value: any;
|
|
340
347
|
label: string;
|
|
341
348
|
}
|
|
@@ -343,7 +350,7 @@ export interface SelectOption {
|
|
|
343
350
|
/**
|
|
344
351
|
* Field rule IDs by category
|
|
345
352
|
*/
|
|
346
|
-
export interface
|
|
353
|
+
export interface FieldRuleIdsType {
|
|
347
354
|
validation: string[];
|
|
348
355
|
computation: string[];
|
|
349
356
|
businessLogic: string[];
|
|
@@ -353,12 +360,12 @@ export interface FieldRuleIds {
|
|
|
353
360
|
* Form field configuration for rendering
|
|
354
361
|
* Contains all metadata needed to render and validate a form field
|
|
355
362
|
*/
|
|
356
|
-
export interface
|
|
363
|
+
export interface FormFieldConfigType {
|
|
357
364
|
/** Field name/identifier */
|
|
358
365
|
name: string;
|
|
359
366
|
|
|
360
367
|
/** Field input type */
|
|
361
|
-
type:
|
|
368
|
+
type: FormFieldTypeType;
|
|
362
369
|
|
|
363
370
|
/** Display label */
|
|
364
371
|
label: string;
|
|
@@ -373,7 +380,7 @@ export interface FormFieldConfig {
|
|
|
373
380
|
defaultValue?: any;
|
|
374
381
|
|
|
375
382
|
/** Select options (for select/reference fields) */
|
|
376
|
-
options?:
|
|
383
|
+
options?: SelectOptionType[];
|
|
377
384
|
|
|
378
385
|
/** Validation configuration */
|
|
379
386
|
validation: any;
|
|
@@ -382,22 +389,22 @@ export interface FormFieldConfig {
|
|
|
382
389
|
description?: string;
|
|
383
390
|
|
|
384
391
|
/** Original BDO field definition (for advanced use) */
|
|
385
|
-
_bdoField:
|
|
392
|
+
_bdoField: BDOFieldDefinitionType;
|
|
386
393
|
|
|
387
394
|
/** Field permissions for current user */
|
|
388
|
-
permission:
|
|
395
|
+
permission: FieldPermissionType;
|
|
389
396
|
|
|
390
397
|
/** Associated rule IDs by category */
|
|
391
|
-
rules:
|
|
398
|
+
rules: FieldRuleIdsType;
|
|
392
399
|
}
|
|
393
400
|
|
|
394
401
|
/**
|
|
395
402
|
* Form schema configuration after processing
|
|
396
403
|
* Contains all fields and rules ready for form rendering
|
|
397
404
|
*/
|
|
398
|
-
export interface
|
|
405
|
+
export interface FormSchemaConfigType {
|
|
399
406
|
/** All fields by name */
|
|
400
|
-
fields: Record<string,
|
|
407
|
+
fields: Record<string, FormFieldConfigType>;
|
|
401
408
|
|
|
402
409
|
/** Field names in display order */
|
|
403
410
|
fieldOrder: string[];
|
|
@@ -409,20 +416,20 @@ export interface FormSchemaConfig {
|
|
|
409
416
|
requiredFields: string[];
|
|
410
417
|
|
|
411
418
|
/** Cross-field validation rules */
|
|
412
|
-
crossFieldValidation:
|
|
419
|
+
crossFieldValidation: SchemaValidationRuleType[];
|
|
413
420
|
|
|
414
421
|
/** Classified rules by type */
|
|
415
422
|
rules: {
|
|
416
|
-
validation: Record<string,
|
|
417
|
-
computation: Record<string,
|
|
418
|
-
businessLogic: Record<string,
|
|
423
|
+
validation: Record<string, SchemaValidationRuleType>;
|
|
424
|
+
computation: Record<string, SchemaValidationRuleType>;
|
|
425
|
+
businessLogic: Record<string, SchemaValidationRuleType>;
|
|
419
426
|
};
|
|
420
427
|
|
|
421
428
|
/** Field-to-rule mapping for quick lookup */
|
|
422
|
-
fieldRules: Record<string,
|
|
429
|
+
fieldRules: Record<string, FieldRuleIdsType>;
|
|
423
430
|
|
|
424
431
|
/** Role permissions */
|
|
425
|
-
rolePermissions?: Record<string,
|
|
432
|
+
rolePermissions?: Record<string, RolePermissionType>;
|
|
426
433
|
}
|
|
427
434
|
|
|
428
435
|
// ============================================================
|
|
@@ -432,7 +439,7 @@ export interface FormSchemaConfig {
|
|
|
432
439
|
/**
|
|
433
440
|
* useForm hook return type with flattened state access and strict typing
|
|
434
441
|
*/
|
|
435
|
-
export interface
|
|
442
|
+
export interface UseFormReturnType<
|
|
436
443
|
T extends Record<string, any> = Record<string, any>,
|
|
437
444
|
> {
|
|
438
445
|
// ============================================================
|
|
@@ -476,7 +483,7 @@ export interface UseFormReturn<
|
|
|
476
483
|
* // Programmatic submission
|
|
477
484
|
* await form.handleSubmit(onSuccess, onError)();
|
|
478
485
|
*/
|
|
479
|
-
handleSubmit:
|
|
486
|
+
handleSubmit: HandleSubmitType<T>;
|
|
480
487
|
|
|
481
488
|
/** Watch field values with strict typing */
|
|
482
489
|
watch: <K extends Path<T> | readonly Path<T>[]>(
|
|
@@ -516,13 +523,6 @@ export interface UseFormReturn<
|
|
|
516
523
|
/** Form submission was successful - direct access */
|
|
517
524
|
isSubmitSuccessful: boolean;
|
|
518
525
|
|
|
519
|
-
// ============================================================
|
|
520
|
-
// BACKWARD COMPATIBILITY
|
|
521
|
-
// ============================================================
|
|
522
|
-
|
|
523
|
-
/** Form state object (for backward compatibility with existing components) */
|
|
524
|
-
formState: FormState<T>;
|
|
525
|
-
|
|
526
526
|
// ============================================================
|
|
527
527
|
// LOADING STATES
|
|
528
528
|
// ============================================================
|
|
@@ -536,6 +536,16 @@ export interface UseFormReturn<
|
|
|
536
536
|
/** Any loading state active */
|
|
537
537
|
isLoading: boolean;
|
|
538
538
|
|
|
539
|
+
// ============================================================
|
|
540
|
+
// INTERACTIVE MODE STATE
|
|
541
|
+
// ============================================================
|
|
542
|
+
|
|
543
|
+
/** Draft ID for interactive create mode */
|
|
544
|
+
draftId: string | null;
|
|
545
|
+
|
|
546
|
+
/** Whether draft is being created (interactive create only) */
|
|
547
|
+
isCreatingDraft: boolean;
|
|
548
|
+
|
|
539
549
|
// ============================================================
|
|
540
550
|
// ERROR HANDLING
|
|
541
551
|
// ============================================================
|
|
@@ -551,10 +561,10 @@ export interface UseFormReturn<
|
|
|
551
561
|
// ============================================================
|
|
552
562
|
|
|
553
563
|
/** Raw BDO schema */
|
|
554
|
-
schema:
|
|
564
|
+
schema: BDOSchemaType | null;
|
|
555
565
|
|
|
556
566
|
/** Processed schema configuration for rendering */
|
|
557
|
-
schemaConfig:
|
|
567
|
+
schemaConfig: FormSchemaConfigType | null;
|
|
558
568
|
|
|
559
569
|
/** Computed field names as typed array */
|
|
560
570
|
computedFields: Array<keyof T>;
|
|
@@ -567,10 +577,10 @@ export interface UseFormReturn<
|
|
|
567
577
|
// ============================================================
|
|
568
578
|
|
|
569
579
|
/** Get field configuration with strict typing */
|
|
570
|
-
getField: <K extends keyof T>(fieldName: K) =>
|
|
580
|
+
getField: <K extends keyof T>(fieldName: K) => FormFieldConfigType | null;
|
|
571
581
|
|
|
572
582
|
/** Get all field configurations with strict typing */
|
|
573
|
-
getFields: () => Record<keyof T,
|
|
583
|
+
getFields: () => Record<keyof T, FormFieldConfigType>;
|
|
574
584
|
|
|
575
585
|
/** Check if field exists with strict typing */
|
|
576
586
|
hasField: <K extends keyof T>(fieldName: K) => boolean;
|
|
@@ -602,7 +612,7 @@ export interface UseFormReturn<
|
|
|
602
612
|
/**
|
|
603
613
|
* Expression evaluation context
|
|
604
614
|
*/
|
|
605
|
-
export interface
|
|
615
|
+
export interface ExpressionContextType<T = Record<string, any>> {
|
|
606
616
|
/** Current form values */
|
|
607
617
|
formValues: Partial<T>;
|
|
608
618
|
|
|
@@ -616,7 +626,7 @@ export interface ExpressionContext<T = Record<string, any>> {
|
|
|
616
626
|
/**
|
|
617
627
|
* Field validation result
|
|
618
628
|
*/
|
|
619
|
-
export interface
|
|
629
|
+
export interface FieldValidationResultType<T = Record<string, any>> {
|
|
620
630
|
/** Is validation passing */
|
|
621
631
|
isValid: boolean;
|
|
622
632
|
|
|
@@ -630,7 +640,7 @@ export interface FieldValidationResult<T = Record<string, any>> {
|
|
|
630
640
|
/**
|
|
631
641
|
* Form submission result
|
|
632
642
|
*/
|
|
633
|
-
export interface
|
|
643
|
+
export interface SubmissionResultType {
|
|
634
644
|
/** Was submission successful */
|
|
635
645
|
success: boolean;
|
|
636
646
|
|