Interface
The interface for all message actions. Message action executes when a matched message is received.
Properties
| Property | Type | Notes |
|---|---|---|
configAIAction | AIAction | AI action to config this message action. |
id | string | The unique id of the action. For actions provided by a widget, the id is: widgetId + actionName. |
label | string | The action label. To support i18n, use |
name | string | The action name. |
sectionId | string | The section ID that provides the action. If a widget id or section id is not provided, the action is provided by the Jimu framework. |
widgetId | string | The widget ID that provides the action. If a widget id or section id is not provided, the action is provided by the Jimu framework. |
configAIAction
configAIAction: AIActionAI action to config this message action.
id
Interface Propertyid: stringThe unique id of the action. For actions provided by a widget, the id is: widgetId + actionName.
label
Interface Propertylabel: stringThe action label. To support i18n, use _action_${actionName} as the string key.
Methods
| Method | Returns | Notes |
|---|---|---|
destroy() | void | When a widget is removed, actions provided by this widget will be destroyed. |
filterMessage(message) | boolean | This indicates whether a specific message can trigger the filter message action. This method is used to filter messages in the message manager. |
filterMessageDescription(messageDescription) | boolean | This indicates whether or not the type of message can trigger the filter message action. This method is used in builder to filter the available actions. |
getCustomTargetLabel(actionConfig?) | string | ReactElement<unknown, string | JSXElementConstructor<any>> | Returns a custom target label displayed by the message action setting. If no label is returned, the message action setting uses its default target-label behavior. |
getDefaultMessageActionConfig(message) | any | Get the default message action config. This method is called when a new message action is configured in the builder. |
getEffectMessages(actionConfig?) | EffectMessageJson[] | Returns the messages that may be published after this action executes. |
getSettingComponentUri(messageType, messageWidgetId?, messageDataSourceId?) | string | This returns the action setting component uri. The returned value should match the
|
onExecute(message, actionConfig?, actionConfigId?) | boolean | Promise<boolean> | The execution of the action when the message is matched. |
onRemoveListen(messageType, messageWidgetId?, messageDataSourceId?) | void | When an action is removed from a message's listener, this function will be invoked. |
destroy
Interface Methoddestroy(): voidWhen a widget is removed, actions provided by this widget will be destroyed.
Returns
voidfilterMessage
Interface MethodfilterMessage(message: Message): booleanThis indicates whether a specific message can trigger the filter message action. This method is used to filter messages in the message manager.
Parameters
| Parameter | Type |
|---|---|
message | Message |
Returns
booleanfilterMessageDescription
Interface MethodfilterMessageDescription(messageDescription: MessageDescription): booleanThis indicates whether or not the type of message can trigger the filter message action. This method is used in builder to filter the available actions.
Parameters
| Parameter | Type |
|---|---|
message | MessageDescription |
Returns
booleangetCustomTargetLabel
getCustomTargetLabel(actionConfig?: any): string | ReactElement<unknown, string | JSXElementConstructor<any>>Returns a custom target label displayed by the message action setting. If no label is returned, the message action setting uses its default target-label behavior.
Parameters
| Parameter | Type |
|---|---|
action | any |
Returns
string | ReactElement<unknown, string | JSXElementConstructor<any>>getDefaultMessageActionConfig
getDefaultMessageActionConfig(message: Message): anyGet the default message action config. This method is called when a new message action is configured in the builder.
Parameters
| Parameter | Type |
|---|---|
message | Message |
Returns
anygetEffectMessages
getEffectMessages(actionConfig?: any): EffectMessageJson[]Returns the messages that may be published after this action executes.
Parameters
| Parameter | Type |
|---|---|
action | any |
Returns
EffectMessageJson[]getSettingComponentUri
getSettingComponentUri(messageType: MessageType, messageWidgetId?: string, messageDataSourceId?: string): stringThis returns the action setting component uri. The returned value should match the
settingUri from the widget manifest. If no setting is required, null is returned.
This method is required for framework actions but optional for widget actions.
This setting component is used to configure the action according to the message.
Parameters
| Parameter | Type |
|---|---|
message | MessageType |
message | string |
message | string |
Returns
stringonExecute
Interface MethodonExecute(message: Message, actionConfig?: any, actionConfigId?: string): boolean | Promise<boolean>The execution of the action when the message is matched.
Please make sure this method returns true to indicate the action is executed successfully, so the following actions can be executed.
Parameters
| Parameter | Type | Notes |
|---|---|---|
message | Message | |
action | any | |
action | string | The ID of the configured action, distinct from the registered action's ID. |
Returns
boolean | Promise<boolean>onRemoveListen
Interface MethodonRemoveListen(messageType: MessageType, messageWidgetId?: string, messageDataSourceId?: string): voidWhen an action is removed from a message's listener, this function will be invoked.
Parameters
| Parameter | Type |
|---|---|
message | MessageType |
message | string |
message | string |
Returns
void