@ram_28/kf-ai-sdk 1.0.8 → 1.0.9
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 +86 -93
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.mjs +1003 -1009
- 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 +107 -113
- package/sdk/components/hooks/useForm/useForm.ts +54 -54
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { useTable } from "./useTable";
|
|
2
2
|
export type { UseTableOptions, UseTableReturn, ColumnDefinition, } from "./useTable";
|
|
3
3
|
export { useForm } from "./useForm";
|
|
4
|
-
export type { UseFormOptions, UseFormReturn,
|
|
4
|
+
export type { UseFormOptions, UseFormReturn, FormOperation, FormMode, FormFieldConfig, FormSchemaConfig, FormFieldType, SelectOption, FieldPermission, FieldValidationResult, SubmissionResult, BDOSchema, BDOFieldDefinition, SchemaValidationRule, } from "./useForm";
|
|
5
|
+
export { parseApiError, isNetworkError, isValidationError, clearFormCache, } from "./useForm";
|
|
5
6
|
export { useKanban } from "./useKanban";
|
|
6
7
|
export type { UseKanbanOptions, UseKanbanReturn, KanbanCard, KanbanColumn, ColumnDefinition as KanbanColumnDefinition, } from "./useKanban";
|
|
7
8
|
export * from "./useFilter";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sdk/components/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sdk/components/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAEV,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EAGR,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,eAAe,EAGf,qBAAqB,EACrB,gBAAgB,EAGhB,SAAS,EACT,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,IAAI,sBAAsB,GAC3C,MAAM,aAAa,CAAC;AAGrB,cAAc,aAAa,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BDOSchema, FormOperation, SubmissionResult } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Fetch BDO schema from backend metadata endpoint
|
|
4
4
|
*/
|
|
5
|
-
export declare function fetchFormSchema(source: string): Promise<
|
|
5
|
+
export declare function fetchFormSchema(source: string): Promise<BDOSchema>;
|
|
6
6
|
/**
|
|
7
7
|
* Fetch form schema with retry logic
|
|
8
8
|
*/
|
|
9
|
-
export declare function fetchFormSchemaWithRetry(source: string, maxRetries?: number): Promise<
|
|
9
|
+
export declare function fetchFormSchemaWithRetry(source: string, maxRetries?: number): Promise<BDOSchema>;
|
|
10
10
|
/**
|
|
11
11
|
* Fetch existing record for update operations
|
|
12
12
|
*/
|
|
@@ -63,7 +63,7 @@ export declare function clearCache(keyPrefix?: string): void;
|
|
|
63
63
|
/**
|
|
64
64
|
* Fetch schema with caching
|
|
65
65
|
*/
|
|
66
|
-
export declare function fetchFormSchemaWithCache(source: string): Promise<
|
|
66
|
+
export declare function fetchFormSchemaWithCache(source: string): Promise<BDOSchema>;
|
|
67
67
|
/**
|
|
68
68
|
* Fetch reference data with caching
|
|
69
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/apiClient.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/apiClient.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM1E;;GAEG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAmBxE;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,MAAU,GACrB,OAAO,CAAC,SAAS,CAAC,CAmBpB;AAMD;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,GAAG,EACvC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,CAAC,CAAC,CAUZ;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,GAAG,EAC1C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAoC3B;AAMD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,MAAM,EAAY,EAC1B,OAAO,CAAC,EAAE,GAAG,EACb,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,GAAG,EAAE,CAAC,CA0BhB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CA+BhC;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,cAAc,EAAE,MAAM,EAAE,GACvB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAexC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,cAAc,EAAE,MAAM,EAAE,EACxB,SAAS,GAAE,aAAwB,EACnC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,CAAC,CAAC,CA0CZ;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAkBhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAOlD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAOrD;AAWD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,GAAG,EACT,UAAU,GAAE,MAAW,GACtB,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAapD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CASnD;AAMD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,SAAS,CAAC,CAYpB;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,MAAM,EAAY,EAC1B,OAAO,CAAC,EAAE,GAAG,EACb,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,GAAG,EAAE,CAAC,CAYhB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExpressionTree,
|
|
1
|
+
import type { ExpressionTree, FieldValidationResult, SchemaValidationRule } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Evaluate a complete expression tree
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ export declare function evaluateExpression(expressionTree: ExpressionTree, formV
|
|
|
6
6
|
/**
|
|
7
7
|
* Validate a field using backend validation rules
|
|
8
8
|
*/
|
|
9
|
-
export declare function validateField<T = Record<string, any>>(fieldName: string, fieldValue: any, validationRules:
|
|
9
|
+
export declare function validateField<T = Record<string, any>>(fieldName: string, fieldValue: any, validationRules: SchemaValidationRule[], formValues: T, referenceData?: Record<string, any>): FieldValidationResult<T>;
|
|
10
10
|
/**
|
|
11
11
|
* Validate all cross-field validation rules
|
|
12
12
|
*/
|
|
@@ -16,7 +16,7 @@ export declare function validateCrossField<T = Record<string, any>>(validationRu
|
|
|
16
16
|
ExpressionTree: ExpressionTree;
|
|
17
17
|
};
|
|
18
18
|
Message: string;
|
|
19
|
-
}>, formValues: T, referenceData?: Record<string, any>):
|
|
19
|
+
}>, formValues: T, referenceData?: Record<string, any>): FieldValidationResult<T>[];
|
|
20
20
|
/**
|
|
21
21
|
* Calculate computed field value
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expressionValidator.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/expressionValidator.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAEd,
|
|
1
|
+
{"version":3,"file":"expressionValidator.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/expressionValidator.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAEd,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AA6SjB;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACtC,GAAG,CAaL;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,GAAG,EACf,eAAe,EAAE,oBAAoB,EAAE,EACvC,UAAU,EAAE,CAAC,EACb,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACtC,qBAAqB,CAAC,CAAC,CAAC,CAgC1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,eAAe,EAAE,KAAK,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE;QAAE,cAAc,EAAE,cAAc,CAAA;KAAE,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,EACF,UAAU,EAAE,CAAC,EACb,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACtC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAwB5B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACtC,GAAG,CAOL;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,cAAc,EAC9B,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GACtC,GAAG,CAOL"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { useForm } from './useForm';
|
|
2
|
-
export type { UseFormOptions, UseFormReturn,
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
2
|
+
export type { UseFormOptions, UseFormReturn, FormOperation, FormMode, } from './types';
|
|
3
|
+
export type { FormFieldConfig, FormSchemaConfig, FormFieldType, SelectOption, FieldPermission, FieldRuleIds, } from './types';
|
|
4
|
+
export type { FieldValidationResult, SubmissionResult, } from './types';
|
|
5
|
+
export type { BDOSchema, BDOFieldDefinition, SchemaValidationRule, ComputedFieldFormula, DefaultValueExpression, ReferenceFieldConfig, FieldOptionsConfig, ExpressionTree, BusinessObjectRules, RolePermission, RuleType, } from './types';
|
|
6
|
+
export type { ExpressionContext, } from './types';
|
|
7
|
+
export { parseApiError, isNetworkError, isValidationError, } from './apiClient';
|
|
8
|
+
export { clearCache as clearFormCache } from './apiClient';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,YAAY,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,GACT,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,QAAQ,GACT,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExpressionTree,
|
|
1
|
+
import type { ExpressionTree, FieldValidationResult, SchemaValidationRule } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Analyze expression dependencies for optimized watching
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ export declare function analyzeExpressionDependencies(expression: ExpressionTree
|
|
|
6
6
|
/**
|
|
7
7
|
* Build dependency graph for multiple expressions
|
|
8
8
|
*/
|
|
9
|
-
export declare function buildDependencyGraph(rules: Record<string,
|
|
9
|
+
export declare function buildDependencyGraph(rules: Record<string, SchemaValidationRule>): Map<string, Set<string>>;
|
|
10
10
|
/**
|
|
11
11
|
* Optimized expression evaluator with caching and memoization
|
|
12
12
|
*/
|
|
@@ -63,7 +63,7 @@ declare const globalEvaluator: OptimizedExpressionEvaluator;
|
|
|
63
63
|
/**
|
|
64
64
|
* Optimized field validation with caching
|
|
65
65
|
*/
|
|
66
|
-
export declare function validateFieldOptimized<T = Record<string, any>>(fieldName: string, fieldValue: any, validationRules:
|
|
66
|
+
export declare function validateFieldOptimized<T = Record<string, any>>(fieldName: string, fieldValue: any, validationRules: SchemaValidationRule[], formValues: T, lastFormValues?: T): FieldValidationResult<T>;
|
|
67
67
|
/**
|
|
68
68
|
* Optimized computed value calculation
|
|
69
69
|
*/
|
|
@@ -78,8 +78,8 @@ export declare function getFieldDependencies(expression: ExpressionTree): string
|
|
|
78
78
|
export declare function batchValidateFields<T = Record<string, any>>(validations: Array<{
|
|
79
79
|
fieldName: string;
|
|
80
80
|
fieldValue: any;
|
|
81
|
-
rules:
|
|
82
|
-
}>, formValues: T, lastFormValues?: T): Array<
|
|
81
|
+
rules: SchemaValidationRule[];
|
|
82
|
+
}>, formValues: T, lastFormValues?: T): Array<FieldValidationResult<T>>;
|
|
83
83
|
/**
|
|
84
84
|
* Clear global expression cache
|
|
85
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimizedExpressionValidator.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"optimizedExpressionValidator.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AA+CjB;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,cAAc,GACzB,GAAG,CAAC,MAAM,CAAC,CA6Bb;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC1C,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAS1B;AAMD;;GAEG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,mBAAmB,CAA+B;IAE1D;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC;IAYxD;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB;;OAEG;IACH,QAAQ,CACN,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,GAAG;IAeN;;OAEG;IACH,OAAO,CAAC,YAAY;IAyBpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwB1B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA2BhC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA2BjC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAgD9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAehC;;OAEG;IACH,UAAU,IAAI,IAAI;CAKnB;AAOD,QAAA,MAAM,eAAe,8BAAqC,CAAC;AAE3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5D,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,GAAG,EACf,eAAe,EAAE,oBAAoB,EAAE,EACvC,UAAU,EAAE,CAAC,EACb,cAAc,CAAC,EAAE,CAAC,GACjB,qBAAqB,CAAC,CAAC,CAAC,CA4B1B;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnC,GAAG,CAOL;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,EAAE,CAEzE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzD,WAAW,EAAE,KAAK,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,GAAG,CAAC;IAChB,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC,EACF,UAAU,EAAE,CAAC,EACb,cAAc,CAAC,EAAE,CAAC,GACjB,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAIjC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAGD,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BDOSchema,
|
|
1
|
+
import type { BDOSchema, BDOFieldDefinition, FormSchemaConfig, SchemaValidationRule, RuleType, FieldPermission } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Normalize BDO schema to ensure validation rules are in centralized format
|
|
4
4
|
* Extracts inline validation rules from fields and adds them to Rules.Validation
|
|
@@ -7,8 +7,8 @@ export declare function normalizeBDOSchema(schema: BDOSchema): BDOSchema;
|
|
|
7
7
|
/**
|
|
8
8
|
* Classify rules by type from BDO schema
|
|
9
9
|
*/
|
|
10
|
-
export declare function classifyRules(schema: BDOSchema):
|
|
11
|
-
export declare function createFieldRuleMapping(schema: BDOSchema, classifiedRules:
|
|
10
|
+
export declare function classifyRules(schema: BDOSchema): FormSchemaConfig["rules"];
|
|
11
|
+
export declare function createFieldRuleMapping(schema: BDOSchema, classifiedRules: FormSchemaConfig["rules"]): FormSchemaConfig["fieldRules"];
|
|
12
12
|
/**
|
|
13
13
|
* Calculate field permissions based on user role
|
|
14
14
|
*/
|
|
@@ -20,9 +20,10 @@ export declare function getRuleExecutionStrategy(ruleType: RuleType): "client" |
|
|
|
20
20
|
/**
|
|
21
21
|
* Get rules that should execute for a specific trigger
|
|
22
22
|
*/
|
|
23
|
-
export declare function getRulesForField(fieldName: string, fieldRules:
|
|
23
|
+
export declare function getRulesForField(fieldName: string, fieldRules: FormSchemaConfig["fieldRules"], classifiedRules: FormSchemaConfig["rules"], executionType: "client" | "server"): SchemaValidationRule[];
|
|
24
24
|
/**
|
|
25
|
-
* Convert legacy
|
|
25
|
+
* Convert legacy schema format to BDO format
|
|
26
|
+
* @deprecated Legacy schema format is no longer supported
|
|
26
27
|
*/
|
|
27
|
-
export declare function convertLegacySchema(legacySchema:
|
|
28
|
+
export declare function convertLegacySchema(legacySchema: Record<string, BDOFieldDefinition>): BDOSchema;
|
|
28
29
|
//# sourceMappingURL=ruleClassifier.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruleClassifier.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/ruleClassifier.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"ruleClassifier.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/ruleClassifier.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,eAAe,EAChB,MAAM,SAAS,CAAC;AAkCjB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAyF/D;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAqB1E;AAsDD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAAC,GACzC,gBAAgB,CAAC,YAAY,CAAC,CAsDhC;AAMD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAsCjC;AAMD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,GACjB,QAAQ,GAAG,QAAQ,CAUrB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAC1C,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAC1C,aAAa,EAAE,QAAQ,GAAG,QAAQ,GACjC,oBAAoB,EAAE,CA4BxB;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,CAyB/F"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BDOSchema, FormFieldConfig, FormSchemaConfig } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
* Process complete
|
|
3
|
+
* Process complete BDO schema
|
|
4
4
|
*/
|
|
5
|
-
export declare function processSchema(schema:
|
|
5
|
+
export declare function processSchema(schema: BDOSchema, formValues?: Record<string, any>, userRole?: string): FormSchemaConfig;
|
|
6
6
|
/**
|
|
7
7
|
* Update computed field values based on current form values
|
|
8
8
|
*/
|
|
9
|
-
export declare function updateComputedFields(processedSchema:
|
|
9
|
+
export declare function updateComputedFields(processedSchema: FormSchemaConfig, currentValues: Record<string, any>): Record<string, any>;
|
|
10
10
|
/**
|
|
11
11
|
* Build field dependency map
|
|
12
12
|
*/
|
|
13
|
-
export declare function buildDependencyMap(processedSchema:
|
|
13
|
+
export declare function buildDependencyMap(processedSchema: FormSchemaConfig): Record<string, string[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Validate processed schema
|
|
16
16
|
*/
|
|
17
|
-
export declare function validateSchema(processedSchema:
|
|
17
|
+
export declare function validateSchema(processedSchema: FormSchemaConfig): {
|
|
18
18
|
isValid: boolean;
|
|
19
19
|
errors: string[];
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Build reference field configuration for API calls
|
|
23
23
|
*/
|
|
24
|
-
export declare function buildReferenceFieldConfig(field:
|
|
24
|
+
export declare function buildReferenceFieldConfig(field: FormFieldConfig): any;
|
|
25
25
|
/**
|
|
26
26
|
* Extract all reference field configurations from schema
|
|
27
27
|
*/
|
|
28
|
-
export declare function extractReferenceFields(processedSchema:
|
|
28
|
+
export declare function extractReferenceFields(processedSchema: FormSchemaConfig): Record<string, any>;
|
|
29
29
|
//# sourceMappingURL=schemaParser.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaParser.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/schemaParser.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"schemaParser.utils.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useForm/schemaParser.utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,SAAS,EAET,eAAe,EACf,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAkPjB;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAsElB;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,gBAAgB,EACjC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAsBrB;AAkCD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,gBAAgB,GAChC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAkC1B;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,gBAAgB,GAAG;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAqBA;AAMD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAarE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,gBAAgB,GAChC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAarB"}
|
|
@@ -8,6 +8,7 @@ export type ExtendedHandleSubmit<T extends RHFFieldValues> = {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Expression tree node types from backend validation system
|
|
11
|
+
* Used for evaluating validation rules, computed fields, and default values
|
|
11
12
|
*/
|
|
12
13
|
export interface ExpressionTree {
|
|
13
14
|
Type: "BinaryExpression" | "LogicalExpression" | "CallExpression" | "MemberExpression" | "AssignmentExpression" | "SystemIdentifier" | "Identifier" | "Literal";
|
|
@@ -25,9 +26,10 @@ export interface ExpressionTree {
|
|
|
25
26
|
Value?: any;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Validation rule from BDO schema
|
|
30
|
+
* Defines a validation, computation, or business logic rule
|
|
29
31
|
*/
|
|
30
|
-
export interface
|
|
32
|
+
export interface SchemaValidationRule {
|
|
31
33
|
Id: string;
|
|
32
34
|
Name: string;
|
|
33
35
|
Description: string;
|
|
@@ -37,9 +39,9 @@ export interface ValidationRule {
|
|
|
37
39
|
Message?: string;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
42
|
+
* Formula definition for computed fields
|
|
41
43
|
*/
|
|
42
|
-
export interface
|
|
44
|
+
export interface ComputedFieldFormula {
|
|
43
45
|
Id?: string;
|
|
44
46
|
Name?: string;
|
|
45
47
|
Description?: string;
|
|
@@ -48,16 +50,16 @@ export interface Formula {
|
|
|
48
50
|
ResultType?: string;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
|
-
*
|
|
53
|
+
* Default value expression for a field
|
|
52
54
|
*/
|
|
53
|
-
export interface
|
|
55
|
+
export interface DefaultValueExpression {
|
|
54
56
|
Expression: string;
|
|
55
57
|
ExpressionTree: ExpressionTree;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
|
-
*
|
|
60
|
+
* Reference field configuration for dynamic lookups
|
|
59
61
|
*/
|
|
60
|
-
export interface
|
|
62
|
+
export interface ReferenceFieldConfig {
|
|
61
63
|
Mode: "Dynamic" | "Static";
|
|
62
64
|
Reference?: {
|
|
63
65
|
BusinessObject: string;
|
|
@@ -67,7 +69,7 @@ export interface ReferenceField {
|
|
|
67
69
|
LhsField: string;
|
|
68
70
|
Operator: string;
|
|
69
71
|
RhsType: string;
|
|
70
|
-
RhsValue?:
|
|
72
|
+
RhsValue?: DefaultValueExpression;
|
|
71
73
|
}>;
|
|
72
74
|
};
|
|
73
75
|
Sort?: Array<{
|
|
@@ -77,44 +79,44 @@ export interface ReferenceField {
|
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
|
-
*
|
|
82
|
+
* Field options configuration for select/dropdown fields
|
|
81
83
|
*/
|
|
82
|
-
export interface
|
|
84
|
+
export interface FieldOptionsConfig {
|
|
83
85
|
Mode: "Static" | "Dynamic";
|
|
84
86
|
Items?: Array<{
|
|
85
87
|
Value: string | number | boolean;
|
|
86
88
|
Label: string;
|
|
87
89
|
}>;
|
|
88
|
-
Reference?:
|
|
90
|
+
Reference?: ReferenceFieldConfig["Reference"];
|
|
89
91
|
}
|
|
90
92
|
/**
|
|
91
|
-
*
|
|
93
|
+
* BDO field definition structure
|
|
92
94
|
*/
|
|
93
|
-
export interface
|
|
95
|
+
export interface BDOFieldDefinition {
|
|
94
96
|
Id: string;
|
|
95
97
|
Name: string;
|
|
96
98
|
Type: "String" | "Number" | "Boolean" | "Date" | "DateTime" | "Reference" | "Array" | "Object" | "ActivityFlow";
|
|
97
99
|
Required?: boolean;
|
|
98
100
|
Unique?: boolean;
|
|
99
|
-
DefaultValue?:
|
|
100
|
-
Formula?:
|
|
101
|
+
DefaultValue?: DefaultValueExpression;
|
|
102
|
+
Formula?: ComputedFieldFormula;
|
|
101
103
|
Computed?: boolean;
|
|
102
|
-
Validation?: string[] |
|
|
103
|
-
Values?:
|
|
104
|
+
Validation?: string[] | SchemaValidationRule[];
|
|
105
|
+
Values?: FieldOptionsConfig;
|
|
104
106
|
Items?: {
|
|
105
107
|
Type: string;
|
|
106
|
-
Property?: Record<string,
|
|
108
|
+
Property?: Record<string, BDOFieldDefinition>;
|
|
107
109
|
};
|
|
108
|
-
Property?: Record<string,
|
|
110
|
+
Property?: Record<string, BDOFieldDefinition>;
|
|
109
111
|
Description?: string;
|
|
110
112
|
}
|
|
111
113
|
/**
|
|
112
114
|
* Business Object Rule definitions from BDO schema
|
|
113
115
|
*/
|
|
114
116
|
export interface BusinessObjectRules {
|
|
115
|
-
Computation?: Record<string,
|
|
116
|
-
Validation?: Record<string,
|
|
117
|
-
BusinessLogic?: Record<string,
|
|
117
|
+
Computation?: Record<string, SchemaValidationRule>;
|
|
118
|
+
Validation?: Record<string, SchemaValidationRule>;
|
|
119
|
+
BusinessLogic?: Record<string, SchemaValidationRule>;
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
120
122
|
* Role permission definition from BDO schema
|
|
@@ -134,7 +136,7 @@ export interface RolePermission {
|
|
|
134
136
|
};
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
|
-
* Complete BDO
|
|
139
|
+
* Complete BDO (Business Data Object) schema structure
|
|
138
140
|
*/
|
|
139
141
|
export interface BDOSchema {
|
|
140
142
|
Id: string;
|
|
@@ -142,19 +144,13 @@ export interface BDOSchema {
|
|
|
142
144
|
Kind: "BusinessObject";
|
|
143
145
|
Description: string;
|
|
144
146
|
Rules: BusinessObjectRules;
|
|
145
|
-
Fields: Record<string,
|
|
147
|
+
Fields: Record<string, BDOFieldDefinition>;
|
|
146
148
|
RolePermission: Record<string, RolePermission>;
|
|
147
149
|
Roles: Record<string, {
|
|
148
150
|
Name: string;
|
|
149
151
|
Description: string;
|
|
150
152
|
}>;
|
|
151
153
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Complete backend schema response structure (legacy support)
|
|
154
|
-
*/
|
|
155
|
-
export interface BackendSchema {
|
|
156
|
-
[fieldName: string]: BackendFieldDefinition;
|
|
157
|
-
}
|
|
158
154
|
/**
|
|
159
155
|
* Form operation mode
|
|
160
156
|
*/
|
|
@@ -167,17 +163,6 @@ export type FormMode = Mode;
|
|
|
167
163
|
* Rule classification types
|
|
168
164
|
*/
|
|
169
165
|
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
166
|
/**
|
|
182
167
|
* useForm hook options with strict typing
|
|
183
168
|
*/
|
|
@@ -220,12 +205,10 @@ export interface UseFormOptions<T extends Record<string, any> = Record<string, a
|
|
|
220
205
|
onSchemaError?: (error: Error) => void;
|
|
221
206
|
/** Submit error callback */
|
|
222
207
|
onSubmitError?: (error: Error) => void;
|
|
223
|
-
/** Computation rule callback (called when computation rules are triggered) */
|
|
224
|
-
onComputationRule?: (context: RuleExecutionContext<T>) => Promise<Partial<T>>;
|
|
225
208
|
/** Skip schema fetching (use for testing) */
|
|
226
209
|
skipSchemaFetch?: boolean;
|
|
227
210
|
/** Manual schema (use instead of fetching) */
|
|
228
|
-
schema?:
|
|
211
|
+
schema?: BDOSchema;
|
|
229
212
|
/**
|
|
230
213
|
* Trigger draft API call on every field change (after validation passes)
|
|
231
214
|
* If true: draft API is called for any field change
|
|
@@ -245,67 +228,77 @@ export interface FieldPermission {
|
|
|
245
228
|
hidden: boolean;
|
|
246
229
|
}
|
|
247
230
|
/**
|
|
248
|
-
*
|
|
231
|
+
* Field input types for form rendering
|
|
232
|
+
*/
|
|
233
|
+
export type FormFieldType = "text" | "number" | "email" | "password" | "date" | "datetime-local" | "checkbox" | "select" | "textarea" | "reference";
|
|
234
|
+
/**
|
|
235
|
+
* Select option for dropdown fields
|
|
236
|
+
*/
|
|
237
|
+
export interface SelectOption {
|
|
238
|
+
value: any;
|
|
239
|
+
label: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Field rule IDs by category
|
|
243
|
+
*/
|
|
244
|
+
export interface FieldRuleIds {
|
|
245
|
+
validation: string[];
|
|
246
|
+
computation: string[];
|
|
247
|
+
businessLogic: string[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Form field configuration for rendering
|
|
251
|
+
* Contains all metadata needed to render and validate a form field
|
|
249
252
|
*/
|
|
250
|
-
export interface
|
|
251
|
-
/** Field name */
|
|
253
|
+
export interface FormFieldConfig {
|
|
254
|
+
/** Field name/identifier */
|
|
252
255
|
name: string;
|
|
253
|
-
/** Field type */
|
|
254
|
-
type:
|
|
255
|
-
/**
|
|
256
|
+
/** Field input type */
|
|
257
|
+
type: FormFieldType;
|
|
258
|
+
/** Display label */
|
|
256
259
|
label: string;
|
|
257
260
|
/** Whether field is required */
|
|
258
261
|
required: boolean;
|
|
259
|
-
/** Whether field is computed (read-only) */
|
|
262
|
+
/** Whether field is computed (read-only, auto-calculated) */
|
|
260
263
|
computed: boolean;
|
|
261
264
|
/** Default value */
|
|
262
265
|
defaultValue?: any;
|
|
263
266
|
/** Select options (for select/reference fields) */
|
|
264
|
-
options?:
|
|
265
|
-
|
|
266
|
-
label: string;
|
|
267
|
-
}>;
|
|
268
|
-
/** Validation rules */
|
|
267
|
+
options?: SelectOption[];
|
|
268
|
+
/** Validation configuration */
|
|
269
269
|
validation: any;
|
|
270
270
|
/** Field description/help text */
|
|
271
271
|
description?: string;
|
|
272
|
-
/**
|
|
273
|
-
|
|
272
|
+
/** Original BDO field definition (for advanced use) */
|
|
273
|
+
_bdoField: BDOFieldDefinition;
|
|
274
274
|
/** Field permissions for current user */
|
|
275
275
|
permission: FieldPermission;
|
|
276
|
-
/**
|
|
277
|
-
rules:
|
|
278
|
-
validation: string[];
|
|
279
|
-
computation: string[];
|
|
280
|
-
businessLogic: string[];
|
|
281
|
-
};
|
|
276
|
+
/** Associated rule IDs by category */
|
|
277
|
+
rules: FieldRuleIds;
|
|
282
278
|
}
|
|
283
279
|
/**
|
|
284
|
-
* Form schema after processing
|
|
280
|
+
* Form schema configuration after processing
|
|
281
|
+
* Contains all fields and rules ready for form rendering
|
|
285
282
|
*/
|
|
286
|
-
export interface
|
|
287
|
-
/** All fields */
|
|
288
|
-
fields: Record<string,
|
|
289
|
-
/** Field names in order */
|
|
283
|
+
export interface FormSchemaConfig {
|
|
284
|
+
/** All fields by name */
|
|
285
|
+
fields: Record<string, FormFieldConfig>;
|
|
286
|
+
/** Field names in display order */
|
|
290
287
|
fieldOrder: string[];
|
|
291
|
-
/**
|
|
288
|
+
/** Names of computed fields */
|
|
292
289
|
computedFields: string[];
|
|
293
|
-
/**
|
|
290
|
+
/** Names of required fields */
|
|
294
291
|
requiredFields: string[];
|
|
295
292
|
/** Cross-field validation rules */
|
|
296
|
-
crossFieldValidation:
|
|
293
|
+
crossFieldValidation: SchemaValidationRule[];
|
|
297
294
|
/** Classified rules by type */
|
|
298
295
|
rules: {
|
|
299
|
-
validation: Record<string,
|
|
300
|
-
computation: Record<string,
|
|
301
|
-
businessLogic: Record<string,
|
|
296
|
+
validation: Record<string, SchemaValidationRule>;
|
|
297
|
+
computation: Record<string, SchemaValidationRule>;
|
|
298
|
+
businessLogic: Record<string, SchemaValidationRule>;
|
|
302
299
|
};
|
|
303
300
|
/** Field-to-rule mapping for quick lookup */
|
|
304
|
-
fieldRules: Record<string,
|
|
305
|
-
validation: string[];
|
|
306
|
-
computation: string[];
|
|
307
|
-
businessLogic: string[];
|
|
308
|
-
}>;
|
|
301
|
+
fieldRules: Record<string, FieldRuleIds>;
|
|
309
302
|
/** Role permissions */
|
|
310
303
|
rolePermissions?: Record<string, RolePermission>;
|
|
311
304
|
}
|
|
@@ -347,18 +340,18 @@ export interface UseFormReturn<T extends Record<string, any> = Record<string, an
|
|
|
347
340
|
submitError: Error | null;
|
|
348
341
|
/** Any error active */
|
|
349
342
|
hasError: boolean;
|
|
350
|
-
/** Raw
|
|
351
|
-
schema:
|
|
352
|
-
/** Processed schema for rendering */
|
|
353
|
-
|
|
343
|
+
/** Raw BDO schema */
|
|
344
|
+
schema: BDOSchema | null;
|
|
345
|
+
/** Processed schema configuration for rendering */
|
|
346
|
+
schemaConfig: FormSchemaConfig | null;
|
|
354
347
|
/** Computed field names as typed array */
|
|
355
348
|
computedFields: Array<keyof T>;
|
|
356
349
|
/** Required field names as typed array */
|
|
357
350
|
requiredFields: Array<keyof T>;
|
|
358
|
-
/** Get field
|
|
359
|
-
getField: <K extends keyof T>(fieldName: K) =>
|
|
360
|
-
/** Get all
|
|
361
|
-
getFields: () => Record<keyof T,
|
|
351
|
+
/** Get field configuration with strict typing */
|
|
352
|
+
getField: <K extends keyof T>(fieldName: K) => FormFieldConfig | null;
|
|
353
|
+
/** Get all field configurations with strict typing */
|
|
354
|
+
getFields: () => Record<keyof T, FormFieldConfig>;
|
|
362
355
|
/** Check if field exists with strict typing */
|
|
363
356
|
hasField: <K extends keyof T>(fieldName: K) => boolean;
|
|
364
357
|
/** Check if field is required with strict typing */
|
|
@@ -375,9 +368,9 @@ export interface UseFormReturn<T extends Record<string, any> = Record<string, an
|
|
|
375
368
|
clearErrors: () => void;
|
|
376
369
|
}
|
|
377
370
|
/**
|
|
378
|
-
* Expression evaluation context
|
|
371
|
+
* Expression evaluation context
|
|
379
372
|
*/
|
|
380
|
-
export interface
|
|
373
|
+
export interface ExpressionContext<T = Record<string, any>> {
|
|
381
374
|
/** Current form values */
|
|
382
375
|
formValues: Partial<T>;
|
|
383
376
|
/** System values (NOW, TODAY, CURRENT_USER, etc.) */
|
|
@@ -386,9 +379,9 @@ export interface EvaluationContext<T = Record<string, any>> {
|
|
|
386
379
|
referenceData: Record<string, any[]>;
|
|
387
380
|
}
|
|
388
381
|
/**
|
|
389
|
-
*
|
|
382
|
+
* Field validation result
|
|
390
383
|
*/
|
|
391
|
-
export interface
|
|
384
|
+
export interface FieldValidationResult<T = Record<string, any>> {
|
|
392
385
|
/** Is validation passing */
|
|
393
386
|
isValid: boolean;
|
|
394
387
|
/** Error message if validation fails */
|