EventDefinition
EventDefinition defines the event handling logic in a flow, used to respond to specific event triggers. Events are an important mechanism in the FlowEngine for triggering flow execution.
Type Definition
EventDefinition is actually an alias for ActionDefinition, so it has the same properties and methods.
Registration Method
Property Descriptions
name
Type: string
Required: Yes
Description: The unique identifier for the event.
Used to reference the event in a flow via the on property.
Example:
title
Type: string
Required: No
Description: The display title for the event.
Used for UI display and debugging.
Example:
handler
Type: (ctx: TCtx, params: any) => Promise<any> | any
Required: Yes
Description: The handler function for the event.
The core logic of the event, which receives the context and parameters, and returns the processing result.
Example:
defaultParams
Type: Record<string, any> | ((ctx: TCtx) => Record<string, any> | Promise<Record<string, any>>)
Required: No
Description: The default parameters for the event.
Populates parameters with default values when the event is triggered.
Example:
uiSchema
Type: Record<string, ISchema> | ((ctx: TCtx) => Record<string, ISchema> | Promise<Record<string, ISchema>>)
Required: No
Description: The UI configuration schema for the event.
Defines the display method and form configuration for the event in the UI.
Example:
beforeParamsSave
Type: (ctx: FlowSettingsContext<TModel>, params: any, previousParams: any) => void | Promise<void>
Required: No
Description: Hook function executed before saving parameters.
Executed before event parameters are saved, can be used for parameter validation or transformation.
Example:
afterParamsSave
Type: (ctx: FlowSettingsContext<TModel>, params: any, previousParams: any) => void | Promise<void>
Required: No
Description: Hook function executed after saving parameters.
Executed after event parameters are saved, can be used to trigger other actions.
Example:
uiMode
Type: StepUIMode | ((ctx: FlowRuntimeContext<TModel>) => StepUIMode | Promise<StepUIMode>)
Required: No
Description: The UI display mode for the event.
Controls how the event is displayed in the UI.
Supported modes:
'dialog'- Dialog mode'drawer'- Drawer mode'embed'- Embed mode- Or a custom configuration object
Example:
Built-in Event Types
The FlowEngine has the following common event types built-in:
'click'- Click event'submit'- Submit event'reset'- Reset event'remove'- Remove event'openView'- Open view event'dropdownOpen'- Dropdown open event'popupScroll'- Popup scroll event'search'- Search event'customRequest'- Custom request event'collapseToggle'- Collapse toggle event

