@digiform/wizard 0.1.7 → 0.2.2
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/FormWizard.d.ts +10 -0
- package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts +23 -0
- package/features/api-integration/index.d.ts +12 -0
- package/features/api-integration/services/ActionExecutor.d.ts +18 -0
- package/features/api-integration/services/ApiCallExecutor.d.ts +2 -0
- package/features/api-integration/services/ApiCallService.d.ts +40 -0
- package/features/api-integration/services/DialogExecutor.d.ts +2 -0
- package/features/api-integration/services/GenericTriggerService.d.ts +118 -0
- package/features/api-integration/services/NavigationExecutor.d.ts +2 -0
- package/features/dialog-system/components/ActionDialog/ActionDialog.d.ts +11 -0
- package/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.d.ts +11 -0
- package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts +11 -0
- package/features/dialog-system/index.d.ts +8 -0
- package/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +19 -0
- package/features/form-runtime/FormWizard/FormWizard.d.ts +10 -0
- package/features/form-runtime/components/FormField.d.ts +7 -0
- package/features/form-runtime/components/FormFooter.d.ts +5 -0
- package/features/form-runtime/components/FormHeader.d.ts +9 -0
- package/features/form-runtime/components/FormSection/FormSection.d.ts +6 -0
- package/features/form-runtime/components/FormStep/FormStep.d.ts +2 -0
- package/features/form-runtime/components/ProgressLoaderRuntime.d.ts +12 -0
- package/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.d.ts +2 -0
- package/features/form-runtime/components/displayValue/displayValue.d.ts +21 -0
- package/features/form-runtime/components/index.d.ts +3 -0
- package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts +7 -0
- package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +13 -0
- package/features/form-runtime/config/configResolver.d.ts +14 -0
- package/features/form-runtime/config/index.d.ts +9 -0
- package/features/form-runtime/config/templateConfig.d.ts +148 -0
- package/features/form-runtime/config/templateLoader.d.ts +25 -0
- package/features/form-runtime/config/templateUtils.d.ts +12 -0
- package/features/form-runtime/context/LoaderContext.d.ts +31 -0
- package/features/form-runtime/hooks/index.d.ts +1 -0
- package/features/form-runtime/hooks/useApiActions.d.ts +42 -0
- package/features/form-runtime/hooks/useComponentTriggers.d.ts +42 -0
- package/features/form-runtime/hooks/useComponentVisibility.d.ts +13 -0
- package/features/form-runtime/hooks/useFieldEventHandlers.d.ts +14 -0
- package/features/form-runtime/hooks/useFormContext.d.ts +4 -0
- package/features/form-runtime/hooks/useFormFieldState.d.ts +13 -0
- package/features/form-runtime/hooks/useValidationEvents.d.ts +13 -0
- package/features/form-runtime/index.d.ts +12 -0
- package/features/form-runtime/utils/componentDisplayValue.d.ts +9 -0
- package/features/form-runtime/utils/errorUtils.d.ts +13 -0
- package/features/form-runtime/utils/fieldHelpers.d.ts +38 -0
- package/features/form-runtime/utils/formDataBuilder.d.ts +7 -0
- package/features/form-runtime/utils/formDirtyStateSync.d.ts +77 -0
- package/features/form-runtime/utils/formSaver.d.ts +22 -0
- package/features/form-runtime/utils/index.d.ts +4 -0
- package/features/form-runtime/utils/logger.d.ts +70 -0
- package/features/form-runtime/utils/validation.d.ts +3 -0
- package/features/form-runtime/utils/validationUX.d.ts +70 -0
- package/features/form-runtime/utils/visibilityUtils.d.ts +13 -0
- package/features/index.d.ts +11 -0
- package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +9 -0
- package/features/state-management/index.d.ts +8 -0
- package/features/state-management/machines/__tests__/setup.d.ts +0 -0
- package/features/state-management/machines/__tests__/testUtils.d.ts +78 -0
- package/features/state-management/machines/__tests__/vitest.config.d.ts +2 -0
- package/features/state-management/machines/actions/componentActions.d.ts +10 -0
- package/features/state-management/machines/actions/navigationActions.d.ts +50 -0
- package/features/state-management/machines/actions/saveActions.d.ts +38 -0
- package/features/state-management/machines/actions/validationActions.d.ts +68 -0
- package/features/state-management/machines/componentTriggerEngine.d.ts +90 -0
- package/features/state-management/machines/formMachine.d.ts +216 -0
- package/features/state-management/machines/guards/navigationGuards.d.ts +32 -0
- package/features/state-management/machines/guards/saveGuards.d.ts +55 -0
- package/features/state-management/machines/guards/triggerGuards.d.ts +24 -0
- package/features/state-management/machines/helpers/triggerHelpers.d.ts +14 -0
- package/features/state-management/machines/index.d.ts +4 -0
- package/features/state-management/machines/lazyLoading.d.ts +34 -0
- package/features/state-management/machines/performance.d.ts +80 -0
- package/features/state-management/machines/types.d.ts +315 -0
- package/features/state-management/machines/useFormMachine.d.ts +1508 -0
- package/features/state-management/machines/validation/index.d.ts +5 -0
- package/features/state-management/machines/validation/validateField.d.ts +2 -0
- package/features/state-management/machines/validation/validateForm.d.ts +2 -0
- package/features/state-management/machines/validation/validateSection.d.ts +2 -0
- package/features/state-management/machines/validation/validateStep.d.ts +2 -0
- package/features/state-management/machines/validation/validationTypes.d.ts +1 -0
- package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts +8 -0
- package/features/trigger-action-system/components/ActionManager.d.ts +6 -0
- package/features/trigger-action-system/components/ComponentAlert/ComponentAlert.d.ts +10 -0
- package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +20 -0
- package/features/trigger-action-system/index.d.ts +10 -0
- package/features/trigger-action-system/utils/GenericTriggerEngine.d.ts +118 -0
- package/features/trigger-action-system/utils/triggerActionSystem.d.ts +193 -0
- package/features/validation-system/components/ValidationDebugger.d.ts +2 -0
- package/features/validation-system/index.d.ts +7 -0
- package/features/validation-system/validation/ActionValidation.d.ts +54 -0
- package/features/validation-system/validation/SchemaBuilder.d.ts +36 -0
- package/features/validation-system/validation/ValidationCache.d.ts +36 -0
- package/features/validation-system/validation/ValidationEngine.d.ts +86 -0
- package/features/validation-system/validation/ValidationExecutor.d.ts +36 -0
- package/features/validation-system/validation/index.d.ts +38 -0
- package/features/validation-system/validation/secureValidatorEngine.d.ts +64 -0
- package/features/validation-system/validation/tanstackSchemaAdapter.d.ts +15 -0
- package/features/validation-system/validation/validationService.d.ts +43 -0
- package/index.cjs +231 -284
- package/index.cjs.map +1 -1
- package/index.d.ts +8 -0
- package/index.js +231 -284
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/index.d.ts +0 -0
- package/styles.css +10 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type ComponentConfig, type ComponentValidation, DEFAULT_VALIDATION_MESSAGES, getValidationMessage, type SecureCustomValidator, type ValidationRule, } from '../../../../../../core/src/index.ts';
|
package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionExecution } from '../../../../../../core/src/index.ts';
|
|
2
|
+
interface ActionLoadingIndicatorProps {
|
|
3
|
+
activeActions: Record<string, ActionExecution>;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const ActionLoadingIndicator: import('react').NamedExoticComponent<ActionLoadingIndicatorProps>;
|
|
7
|
+
export { ActionLoadingIndicator };
|
|
8
|
+
export default ActionLoadingIndicator;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentAlert as ComponentAlertType } from '../../../state-management/machines/types';
|
|
2
|
+
interface ComponentAlertProps {
|
|
3
|
+
alert: ComponentAlertType;
|
|
4
|
+
}
|
|
5
|
+
export declare const ComponentAlert: React.FC<ComponentAlertProps>;
|
|
6
|
+
interface ComponentAlertsProps {
|
|
7
|
+
alerts: ComponentAlertType[];
|
|
8
|
+
}
|
|
9
|
+
export declare const ComponentAlerts: React.FC<ComponentAlertsProps>;
|
|
10
|
+
export default ComponentAlert;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FieldWarning as FieldWarningType } from '../../../../../../core/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface FieldWarningProps {
|
|
4
|
+
warning: FieldWarningType;
|
|
5
|
+
onDismiss?: (warningId: string) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const FieldWarning: React.FC<FieldWarningProps>;
|
|
9
|
+
interface FieldWarningListProps {
|
|
10
|
+
fieldId: string;
|
|
11
|
+
warnings: FieldWarningType[];
|
|
12
|
+
onDismiss?: (warningId: string) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Component to display multiple warnings for a field
|
|
17
|
+
* Handles spacing and layout of multiple warnings
|
|
18
|
+
*/
|
|
19
|
+
export declare const FieldWarningList: React.FC<FieldWarningListProps>;
|
|
20
|
+
export default FieldWarning;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger-Action System Feature
|
|
3
|
+
*
|
|
4
|
+
* Components and utilities for handling component triggers and actions
|
|
5
|
+
*/
|
|
6
|
+
export { default as ActionLoadingIndicator } from './components/ActionLoadingIndicator/ActionLoadingIndicator';
|
|
7
|
+
export { default as ActionManager } from './components/ActionManager';
|
|
8
|
+
export { default as ComponentAlert } from './components/ComponentAlert/ComponentAlert';
|
|
9
|
+
export { createTriggerContext, GenericTriggerEngine, } from './utils/GenericTriggerEngine';
|
|
10
|
+
export type { EnhancedComponentConfig, EnhancedFormConfig, EnhancedSectionConfig, EnhancedStepConfig, ExtendedAction, ExtendedActionConfig, ExtendedActionType, ExtendedComponentActionConfig, ExtendedTrigger, ExtendedTriggerActionContainer, ExtendedTriggerCondition, ExtendedTriggerContext, ExtendedTriggerType, } from './utils/triggerActionSystem';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { DataService, ExtendedTrigger, ExtendedTriggerContext, ExtendedTriggerType, NavigationService, TriggerEvaluationContext, UIService, ValidationService } from './triggerActionSystem';
|
|
2
|
+
export declare class GenericTriggerEngine {
|
|
3
|
+
private services;
|
|
4
|
+
private triggers;
|
|
5
|
+
private debounceTimers;
|
|
6
|
+
private throttleTimers;
|
|
7
|
+
constructor(services: {
|
|
8
|
+
navigation: NavigationService;
|
|
9
|
+
ui: UIService;
|
|
10
|
+
data: DataService;
|
|
11
|
+
validation: ValidationService;
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Register triggers for a specific context and target
|
|
15
|
+
*/
|
|
16
|
+
registerTriggers(targetId: string, triggers: ExtendedTrigger[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Unregister triggers for a target
|
|
19
|
+
*/
|
|
20
|
+
unregisterTriggers(targetId: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Evaluate triggers for a given context
|
|
23
|
+
*/
|
|
24
|
+
evaluateTriggers(context: TriggerEvaluationContext): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Execute a single trigger
|
|
27
|
+
*/
|
|
28
|
+
private executeTrigger;
|
|
29
|
+
/**
|
|
30
|
+
* Execute actions for a trigger
|
|
31
|
+
*/
|
|
32
|
+
private executeActions;
|
|
33
|
+
/**
|
|
34
|
+
* Execute a single action
|
|
35
|
+
*/
|
|
36
|
+
private executeAction;
|
|
37
|
+
/**
|
|
38
|
+
* Dispatch action to appropriate handler based on type
|
|
39
|
+
*/
|
|
40
|
+
private dispatchAction;
|
|
41
|
+
/**
|
|
42
|
+
* Evaluate trigger conditions
|
|
43
|
+
*/
|
|
44
|
+
private evaluateConditions;
|
|
45
|
+
/**
|
|
46
|
+
* Evaluate a single condition
|
|
47
|
+
*/
|
|
48
|
+
private evaluateCondition;
|
|
49
|
+
/**
|
|
50
|
+
* Handle debouncing for triggers
|
|
51
|
+
*/
|
|
52
|
+
private handleDebounce;
|
|
53
|
+
/**
|
|
54
|
+
* Check if trigger is currently throttled
|
|
55
|
+
*/
|
|
56
|
+
private isThrottled;
|
|
57
|
+
/**
|
|
58
|
+
* Set throttle timer for trigger
|
|
59
|
+
*/
|
|
60
|
+
private setThrottle;
|
|
61
|
+
/**
|
|
62
|
+
* Clear all timers for a target
|
|
63
|
+
*/
|
|
64
|
+
private clearTimers;
|
|
65
|
+
/**
|
|
66
|
+
* Handle component-specific actions
|
|
67
|
+
*/
|
|
68
|
+
private handleComponentAction;
|
|
69
|
+
/**
|
|
70
|
+
* Handle original value updates
|
|
71
|
+
*/
|
|
72
|
+
private handleUpdateOriginalValue;
|
|
73
|
+
/**
|
|
74
|
+
* Handle custom actions
|
|
75
|
+
*/
|
|
76
|
+
private handleCustomAction;
|
|
77
|
+
/**
|
|
78
|
+
* Evaluate custom conditions
|
|
79
|
+
*/
|
|
80
|
+
private evaluateCustomCondition;
|
|
81
|
+
/**
|
|
82
|
+
* Emit events for external handling
|
|
83
|
+
*/
|
|
84
|
+
private emitEvent;
|
|
85
|
+
/**
|
|
86
|
+
* Type guards for action config validation
|
|
87
|
+
*/
|
|
88
|
+
private isTypedActionConfig;
|
|
89
|
+
private isUIShowAlertConfig;
|
|
90
|
+
private isUIShowDialogConfig;
|
|
91
|
+
private isUIShowNotificationConfig;
|
|
92
|
+
private isNavigationGoToStepConfig;
|
|
93
|
+
private isNavigationGoNextConfig;
|
|
94
|
+
private isNavigationGoPreviousConfig;
|
|
95
|
+
private isNavigationGoToSectionConfig;
|
|
96
|
+
private isComponentEnableConfig;
|
|
97
|
+
private isComponentDisableConfig;
|
|
98
|
+
private isComponentShowHideConfig;
|
|
99
|
+
private isComponentSetValueConfig;
|
|
100
|
+
private isComponentUpdateOriginalValueConfig;
|
|
101
|
+
private isDataApiCallConfig;
|
|
102
|
+
private isDataSetValueConfig;
|
|
103
|
+
private isDataValidationConfig;
|
|
104
|
+
private isCustomActionConfig;
|
|
105
|
+
/**
|
|
106
|
+
* Cleanup resources
|
|
107
|
+
*/
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Utility function to create trigger evaluation context
|
|
112
|
+
*/
|
|
113
|
+
export declare function createTriggerContext(triggerType: ExtendedTriggerType, context: ExtendedTriggerContext, targetId: string, options?: {
|
|
114
|
+
currentValue?: unknown;
|
|
115
|
+
previousValue?: unknown;
|
|
116
|
+
formData?: Record<string, unknown>;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
}): TriggerEvaluationContext;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { ComponentActionConfig, GenericAction, GenericActionType, GenericTrigger, GenericTriggerCondition, GenericTriggerType, TriggerActionContainer, TriggerContext } from '../../../../../core/src/index.ts';
|
|
2
|
+
export type { GenericAction, GenericTrigger, GenericTriggerCondition, GenericTriggerType, TriggerContext, };
|
|
3
|
+
export type ExtendedTriggerContext = TriggerContext | "component" | "section" | "step" | "form";
|
|
4
|
+
export type ExtendedTriggerType = GenericTriggerType | "component:isDirty" | "component:onValueChange" | "component:onFocus" | "component:onBlur" | "component:onMount" | "component:onUnmount" | "section:onSave" | "section:onCancel" | "section:onEdit" | "section:onMount" | "section:onValidation" | "step:onLoad" | "step:onFinish" | "step:onNext" | "step:onPrevious" | "step:onMount" | "step:onUnmount" | "step:onValidation" | "form:onSubmit" | "form:onReset" | "form:onMount" | "form:onUnmount" | "form:onValidation";
|
|
5
|
+
export type ExtendedActionType = GenericActionType | "ui:showAlert" | "ui:showDialog" | "ui:hideDialog" | "ui:showNotification" | "navigation:goToStep" | "navigation:goNext" | "navigation:goPrevious" | "navigation:goToSection" | "component:enable" | "component:disable" | "component:show" | "component:hide" | "component:setValue" | "component:clearValue" | "component:updateOriginalValue" | "data:apiCall" | "data:setValue" | "data:clearValue" | "data:validateField" | "data:validateSection" | "data:validateStep" | "custom:execute";
|
|
6
|
+
export interface ExtendedTriggerCondition extends Omit<GenericTriggerCondition, "operator"> {
|
|
7
|
+
id?: string;
|
|
8
|
+
operator: "equals" | "notEquals" | "contains" | "empty" | "notEmpty" | "isSet" | "isNotSet" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "in" | "notIn" | "matches" | "custom";
|
|
9
|
+
values?: unknown[];
|
|
10
|
+
customEvaluator?: string;
|
|
11
|
+
logicalOperator?: "AND" | "OR";
|
|
12
|
+
}
|
|
13
|
+
export interface ExtendedTrigger extends Omit<GenericTrigger, "type" | "conditions"> {
|
|
14
|
+
type: ExtendedTriggerType;
|
|
15
|
+
context?: ExtendedTriggerContext;
|
|
16
|
+
conditions?: ExtendedTriggerCondition[];
|
|
17
|
+
actions?: ExtendedAction[];
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
order?: number;
|
|
20
|
+
debounceMs?: number;
|
|
21
|
+
throttleMs?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ExtendedAction extends Omit<GenericAction, "type" | "config"> {
|
|
24
|
+
type: ExtendedActionType;
|
|
25
|
+
config: ExtendedActionConfig;
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
delay?: number;
|
|
28
|
+
condition?: ExtendedTriggerCondition;
|
|
29
|
+
}
|
|
30
|
+
export type ExtendedActionConfig = GenericAction["config"] | UIActionConfig | NavigationActionConfig | ExtendedComponentActionConfig | DataActionConfig | CustomActionConfig;
|
|
31
|
+
export interface UIShowAlertConfig {
|
|
32
|
+
type: "ui:showAlert";
|
|
33
|
+
message: string;
|
|
34
|
+
alertType: "info" | "warning" | "error" | "success";
|
|
35
|
+
position: "inline" | "tooltip" | "sidebar" | "toast";
|
|
36
|
+
dismissible?: boolean;
|
|
37
|
+
autoHide?: boolean;
|
|
38
|
+
autoHideDelay?: number;
|
|
39
|
+
targetId?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface UIShowDialogConfig {
|
|
42
|
+
type: "ui:showDialog";
|
|
43
|
+
dialogType: "confirmation" | "email-verification" | "custom";
|
|
44
|
+
template?: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
content?: string;
|
|
47
|
+
buttons?: DialogButtonConfig[];
|
|
48
|
+
templateConfig?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
export interface UIShowNotificationConfig {
|
|
51
|
+
type: "ui:showNotification";
|
|
52
|
+
message: string;
|
|
53
|
+
notificationType: "info" | "warning" | "error" | "success";
|
|
54
|
+
duration?: number;
|
|
55
|
+
position?: "top" | "bottom" | "top-right" | "bottom-right";
|
|
56
|
+
}
|
|
57
|
+
export interface NavigationGoToStepConfig {
|
|
58
|
+
type: "navigation:goToStep";
|
|
59
|
+
stepId: string;
|
|
60
|
+
behavior?: "replace" | "push";
|
|
61
|
+
}
|
|
62
|
+
export interface NavigationGoNextConfig {
|
|
63
|
+
type: "navigation:goNext";
|
|
64
|
+
skipValidation?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface NavigationGoPreviousConfig {
|
|
67
|
+
type: "navigation:goPrevious";
|
|
68
|
+
skipValidation?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface NavigationGoToSectionConfig {
|
|
71
|
+
type: "navigation:goToSection";
|
|
72
|
+
sectionId: string;
|
|
73
|
+
stepId?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface ComponentEnableConfig {
|
|
76
|
+
type: "component:enable";
|
|
77
|
+
componentIds: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface ComponentDisableConfig {
|
|
80
|
+
type: "component:disable";
|
|
81
|
+
componentIds: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface ComponentShowHideConfig {
|
|
84
|
+
type: "component:show" | "component:hide";
|
|
85
|
+
componentIds: string[];
|
|
86
|
+
animation?: "fade" | "slide" | "none";
|
|
87
|
+
}
|
|
88
|
+
export interface ComponentSetValueConfig {
|
|
89
|
+
type: "component:setValue" | "component:clearValue";
|
|
90
|
+
componentId: string;
|
|
91
|
+
value?: unknown;
|
|
92
|
+
}
|
|
93
|
+
export interface ComponentUpdateOriginalValueConfig {
|
|
94
|
+
type: "component:updateOriginalValue";
|
|
95
|
+
componentId: string;
|
|
96
|
+
}
|
|
97
|
+
export interface DataApiCallConfig {
|
|
98
|
+
type: "data:apiCall";
|
|
99
|
+
url: string;
|
|
100
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
101
|
+
headers?: Record<string, string>;
|
|
102
|
+
body?: Record<string, unknown>;
|
|
103
|
+
timeout?: number;
|
|
104
|
+
retryCount?: number;
|
|
105
|
+
fieldMappings?: Record<string, string>;
|
|
106
|
+
onSuccess?: ExtendedAction[];
|
|
107
|
+
onError?: ExtendedAction[];
|
|
108
|
+
}
|
|
109
|
+
export interface DataSetValueConfig {
|
|
110
|
+
type: "data:setValue" | "data:clearValue";
|
|
111
|
+
fieldPath: string;
|
|
112
|
+
value?: unknown;
|
|
113
|
+
}
|
|
114
|
+
export interface DataValidationConfig {
|
|
115
|
+
type: "data:validateField" | "data:validateSection" | "data:validateStep";
|
|
116
|
+
targetId: string;
|
|
117
|
+
showErrors?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface CustomActionConfig {
|
|
120
|
+
type: "custom:execute";
|
|
121
|
+
handler: string;
|
|
122
|
+
parameters?: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
export type UIActionConfig = UIShowAlertConfig | UIShowDialogConfig | UIShowNotificationConfig;
|
|
125
|
+
export type NavigationActionConfig = NavigationGoToStepConfig | NavigationGoNextConfig | NavigationGoPreviousConfig | NavigationGoToSectionConfig;
|
|
126
|
+
export type ExtendedComponentActionConfig = ComponentActionConfig | ComponentEnableConfig | ComponentDisableConfig | ComponentShowHideConfig | ComponentSetValueConfig | ComponentUpdateOriginalValueConfig;
|
|
127
|
+
export type DataActionConfig = DataApiCallConfig | DataSetValueConfig | DataValidationConfig;
|
|
128
|
+
export interface DialogButtonConfig {
|
|
129
|
+
id: string;
|
|
130
|
+
label: string;
|
|
131
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost";
|
|
132
|
+
action: ExtendedAction;
|
|
133
|
+
}
|
|
134
|
+
export interface ExtendedTriggerActionContainer extends Omit<TriggerActionContainer, "triggers" | "actions"> {
|
|
135
|
+
triggers: ExtendedTrigger[];
|
|
136
|
+
actions?: ExtendedAction[];
|
|
137
|
+
}
|
|
138
|
+
export interface EnhancedComponentConfig {
|
|
139
|
+
triggerActions?: ExtendedTriggerActionContainer;
|
|
140
|
+
}
|
|
141
|
+
export interface EnhancedSectionConfig {
|
|
142
|
+
triggerActions?: ExtendedTriggerActionContainer;
|
|
143
|
+
}
|
|
144
|
+
export interface EnhancedStepConfig {
|
|
145
|
+
triggerActions?: ExtendedTriggerActionContainer;
|
|
146
|
+
}
|
|
147
|
+
export interface EnhancedFormConfig {
|
|
148
|
+
triggerActions?: ExtendedTriggerActionContainer;
|
|
149
|
+
}
|
|
150
|
+
export interface TriggerEvaluationContext {
|
|
151
|
+
triggerType: ExtendedTriggerType;
|
|
152
|
+
context: ExtendedTriggerContext;
|
|
153
|
+
targetId: string;
|
|
154
|
+
currentValue?: unknown;
|
|
155
|
+
previousValue?: unknown;
|
|
156
|
+
formData: Record<string, unknown>;
|
|
157
|
+
metadata: Record<string, unknown>;
|
|
158
|
+
timestamp: number;
|
|
159
|
+
}
|
|
160
|
+
export interface ActionExecutionContext {
|
|
161
|
+
action: ExtendedAction;
|
|
162
|
+
triggerContext: TriggerEvaluationContext;
|
|
163
|
+
formData: Record<string, unknown>;
|
|
164
|
+
services: {
|
|
165
|
+
navigation: NavigationService;
|
|
166
|
+
ui: UIService;
|
|
167
|
+
data: DataService;
|
|
168
|
+
validation: ValidationService;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export interface NavigationService {
|
|
172
|
+
goToStep(stepId: string, behavior?: "replace" | "push"): void;
|
|
173
|
+
goNext(skipValidation?: boolean): void;
|
|
174
|
+
goPrevious(skipValidation?: boolean): void;
|
|
175
|
+
goToSection(sectionId: string, stepId?: string): void;
|
|
176
|
+
}
|
|
177
|
+
export interface UIService {
|
|
178
|
+
showAlert(config: UIShowAlertConfig): void;
|
|
179
|
+
showDialog(config: UIShowDialogConfig): void;
|
|
180
|
+
showNotification(config: UIShowNotificationConfig): void;
|
|
181
|
+
hideDialog(): void;
|
|
182
|
+
}
|
|
183
|
+
export interface DataService {
|
|
184
|
+
apiCall(config: DataApiCallConfig): Promise<unknown>;
|
|
185
|
+
setValue(fieldPath: string, value: unknown): void;
|
|
186
|
+
getValue(fieldPath: string): unknown;
|
|
187
|
+
clearValue(fieldPath: string): void;
|
|
188
|
+
}
|
|
189
|
+
export interface ValidationService {
|
|
190
|
+
validateField(fieldId: string): boolean;
|
|
191
|
+
validateSection(sectionId: string): boolean;
|
|
192
|
+
validateStep(stepId: string): boolean;
|
|
193
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ApiCallConfig, DialogConfig, FormAction, FormStepConfig, NavigationConfig, TemplateDialogConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
export declare class ActionValidationError extends Error {
|
|
3
|
+
actionId: string;
|
|
4
|
+
actionType: string;
|
|
5
|
+
details?: any | undefined;
|
|
6
|
+
constructor(actionId: string, actionType: string, message: string, details?: any | undefined);
|
|
7
|
+
}
|
|
8
|
+
export declare class ActionValidator {
|
|
9
|
+
/**
|
|
10
|
+
* Validates a single action configuration
|
|
11
|
+
*/
|
|
12
|
+
static validateAction(action: FormAction): {
|
|
13
|
+
isValid: boolean;
|
|
14
|
+
errors: string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Validates API call configuration
|
|
18
|
+
*/
|
|
19
|
+
static validateApiCallConfig(config: ApiCallConfig): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Validates dialog configuration - supports both direct and template-based configs
|
|
22
|
+
*/
|
|
23
|
+
static validateDialogConfig(config: DialogConfig | TemplateDialogConfig): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Validates template-based dialog configuration
|
|
26
|
+
*/
|
|
27
|
+
static validateTemplateDialogConfig(config: TemplateDialogConfig): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Validates resolved dialog configuration (after template resolution)
|
|
30
|
+
*/
|
|
31
|
+
static validateResolvedDialogConfig(config: DialogConfig): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Validates dialog button action
|
|
34
|
+
*/
|
|
35
|
+
static validateDialogButtonAction(action: any, buttonIndex: number): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Validates navigation configuration
|
|
38
|
+
*/
|
|
39
|
+
static validateNavigationConfig(config: NavigationConfig): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Validates all actions in a step
|
|
42
|
+
*/
|
|
43
|
+
static validateStepActions(step: FormStepConfig): {
|
|
44
|
+
isValid: boolean;
|
|
45
|
+
errors: string[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Validates navigation targets exist
|
|
49
|
+
*/
|
|
50
|
+
static validateNavigationTargets(step: FormStepConfig, allSteps: FormStepConfig[]): {
|
|
51
|
+
isValid: boolean;
|
|
52
|
+
errors: string[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentConfig, FormStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SecureValidatorConfig } from './secureValidatorEngine';
|
|
4
|
+
export type MessageStyle = "withLabel" | "simple";
|
|
5
|
+
/**
|
|
6
|
+
* SchemaBuilder - Creates and manages Zod schemas for validation
|
|
7
|
+
*/
|
|
8
|
+
export declare class SchemaBuilder {
|
|
9
|
+
private messageStyle;
|
|
10
|
+
private secureValidatorConfig?;
|
|
11
|
+
constructor(messageStyle?: MessageStyle, secureValidatorConfig?: Partial<SecureValidatorConfig>);
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Zod schema for a component
|
|
14
|
+
*/
|
|
15
|
+
createComponentSchema(component: ComponentConfig): z.ZodTypeAny;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Zod schema for a step
|
|
18
|
+
*/
|
|
19
|
+
createStepSchema(step: FormStepConfig): z.ZodTypeAny;
|
|
20
|
+
/**
|
|
21
|
+
* Updates the message style
|
|
22
|
+
*/
|
|
23
|
+
updateMessageStyle(messageStyle: MessageStyle): void;
|
|
24
|
+
/**
|
|
25
|
+
* Updates the secure validator config
|
|
26
|
+
*/
|
|
27
|
+
updateSecureValidatorConfig(config: Partial<SecureValidatorConfig>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the current message style
|
|
30
|
+
*/
|
|
31
|
+
getMessageStyle(): MessageStyle;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a component is required based on its validation configuration
|
|
34
|
+
*/
|
|
35
|
+
private isComponentRequired;
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentConfig, FormStepConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SchemaBuilder } from './SchemaBuilder';
|
|
4
|
+
/**
|
|
5
|
+
* ValidationCache - Manages schema caching and cache invalidation
|
|
6
|
+
*/
|
|
7
|
+
export declare class ValidationCache {
|
|
8
|
+
private schemaBuilder;
|
|
9
|
+
private componentSchemaCache;
|
|
10
|
+
private stepSchemaCache;
|
|
11
|
+
constructor(schemaBuilder: SchemaBuilder);
|
|
12
|
+
/**
|
|
13
|
+
* Gets or creates a component schema with caching
|
|
14
|
+
*/
|
|
15
|
+
getComponentSchema(component: ComponentConfig): z.ZodTypeAny;
|
|
16
|
+
/**
|
|
17
|
+
* Gets or creates a step schema with caching
|
|
18
|
+
*/
|
|
19
|
+
getStepSchema(step: FormStepConfig): z.ZodTypeAny;
|
|
20
|
+
/**
|
|
21
|
+
* Clears all cached schemas
|
|
22
|
+
*/
|
|
23
|
+
clearCache(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Invalidates cache when message style changes
|
|
26
|
+
*/
|
|
27
|
+
invalidateOnMessageStyleChange(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Clears cache for a specific component
|
|
30
|
+
*/
|
|
31
|
+
clearComponentCache(componentId: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Clears cache for a specific step
|
|
34
|
+
*/
|
|
35
|
+
clearStepCache(stepId: string): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ComponentConfig, FormData, FormStepConfig, FormWizardConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SecureValidatorConfig } from './secureValidatorEngine';
|
|
4
|
+
import { FieldValidationResult, ValidationResult } from './ValidationExecutor';
|
|
5
|
+
export type { FieldValidationResult, ValidationResult, } from './ValidationExecutor';
|
|
6
|
+
/**
|
|
7
|
+
* Validation options
|
|
8
|
+
*/
|
|
9
|
+
export interface ValidationOptions {
|
|
10
|
+
messageStyle?: "withLabel" | "simple";
|
|
11
|
+
debounceMs?: number;
|
|
12
|
+
secureValidatorConfig?: Partial<SecureValidatorConfig>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Gets default values for a form step based on component types
|
|
16
|
+
*/
|
|
17
|
+
export declare const getStepDefaultValues: (step: FormStepConfig) => Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets a human-readable representation of validation schema for debugging
|
|
20
|
+
*/
|
|
21
|
+
export declare const getReadableValidationSchema: (step: FormStepConfig) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Unified ValidationEngine class that consolidates all validation logic
|
|
24
|
+
* Features:
|
|
25
|
+
* - Debounced validation for performance
|
|
26
|
+
* - Schema caching with memoization
|
|
27
|
+
* - Single API for all validation needs
|
|
28
|
+
* - Support for field, step, and form-level validation
|
|
29
|
+
*
|
|
30
|
+
* This class acts as a facade that orchestrates three main components:
|
|
31
|
+
* - SchemaBuilder: Creates and builds Zod schemas
|
|
32
|
+
* - ValidationExecutor: Executes validation logic and processes results
|
|
33
|
+
* - ValidationCache: Manages schema caching and cache invalidation
|
|
34
|
+
*/
|
|
35
|
+
export declare class ValidationEngine {
|
|
36
|
+
private debounceTimers;
|
|
37
|
+
private debounceMs;
|
|
38
|
+
private schemaBuilder;
|
|
39
|
+
private validationExecutor;
|
|
40
|
+
private validationCache;
|
|
41
|
+
constructor(options?: ValidationOptions);
|
|
42
|
+
/**
|
|
43
|
+
* Validates a single field with debouncing
|
|
44
|
+
*/
|
|
45
|
+
validateFieldDebounced(component: ComponentConfig, value: unknown): Promise<FieldValidationResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Validates a single field immediately (synchronous)
|
|
48
|
+
*/
|
|
49
|
+
validateField(component: ComponentConfig, value: unknown): FieldValidationResult;
|
|
50
|
+
/**
|
|
51
|
+
* Validates all fields in a step
|
|
52
|
+
*/
|
|
53
|
+
validateStep(step: FormStepConfig, data: FormData): Promise<ValidationResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Validates an entire form
|
|
56
|
+
*/
|
|
57
|
+
validateForm(config: FormWizardConfig, data: FormData): Promise<ValidationResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates and caches a Zod schema for a component
|
|
60
|
+
*/
|
|
61
|
+
getComponentSchema(component: ComponentConfig): unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a Zod schema for an entire step
|
|
64
|
+
*/
|
|
65
|
+
getStepSchema(step: FormStepConfig): z.ZodTypeAny;
|
|
66
|
+
/**
|
|
67
|
+
* Clears the schema cache (useful when component configurations change)
|
|
68
|
+
*/
|
|
69
|
+
clearCache(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Clears debounce timers
|
|
72
|
+
*/
|
|
73
|
+
cancelPendingValidations(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Updates validation options
|
|
76
|
+
*/
|
|
77
|
+
updateOptions(options: ValidationOptions): void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Default global validation engine instance
|
|
81
|
+
*/
|
|
82
|
+
export declare const defaultValidationEngine: ValidationEngine;
|
|
83
|
+
/**
|
|
84
|
+
* Hook to get validation engine with form-specific options
|
|
85
|
+
*/
|
|
86
|
+
export declare function createValidationEngine(options?: ValidationOptions): ValidationEngine;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FormWizardConfig } from '../../../../../core/src/index.ts';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SchemaBuilder } from './SchemaBuilder';
|
|
4
|
+
export interface FieldValidationResult {
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
errors: string[];
|
|
7
|
+
value: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
fieldErrors: Record<string, string[]>;
|
|
12
|
+
generalErrors: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ValidationExecutor - Executes validation logic and processes results
|
|
16
|
+
*/
|
|
17
|
+
export declare class ValidationExecutor {
|
|
18
|
+
private schemaBuilder;
|
|
19
|
+
constructor(schemaBuilder: SchemaBuilder);
|
|
20
|
+
/**
|
|
21
|
+
* Validates a single field
|
|
22
|
+
*/
|
|
23
|
+
validateField(value: unknown, schema: z.ZodTypeAny): Promise<FieldValidationResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Validates a single field synchronously
|
|
26
|
+
*/
|
|
27
|
+
validateFieldSync(value: unknown, schema: z.ZodTypeAny): FieldValidationResult;
|
|
28
|
+
/**
|
|
29
|
+
* Validates a step
|
|
30
|
+
*/
|
|
31
|
+
validateStep(data: Record<string, unknown>, schema: z.ZodTypeAny): Promise<ValidationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Validates a form
|
|
34
|
+
*/
|
|
35
|
+
validateForm(config: FormWizardConfig, data: Record<string, unknown>): Promise<ValidationResult>;
|
|
36
|
+
}
|