Skip to content

Interface

A data action is a piece code that can process data. It can process the whole data source, some data records, or both (determined by the isSupported method).

A data action can receive multiple data sets, but the data action can decide whether it supports multiple data sets or not.

The isSupported method is invoked first to test whether the data action can process the provided data. The onExecute method will be invoked when an user click the action menu. Both of these two methods are passed in the DataRecordSet and DataLevel parameters, the widget that uses the data action decides how to pass in DataRecordSet , and the action can decide how to process the data.

Widgets should use the DataActionList component to use the data actions.

Although the data action can be very flexible, for consistent UX, these guides should be followed:

  • For widgets that use data actions:
    • Set the correct DataRecordSet.type and the records, more specifically, pass in the selected records, loaded records or the current record.
  • For data actions:
    • For Records level data action:
      • Use the passed in records , the records are always not empty.
    • For DataSource level data action:
      • Always process all of the data despite the passed-in records.

Properties

PropertyTypeNotes
iconstring | IconResult

The action icon.

idstring

The unique ID. For widget-provided actions, the ID is the combination of the widget ID and action name.

intlIntlShape

The Intl object for i18n.

isWatchingDataSetsChangeboolean

Whether the action is watching the data sets change. If the action is watching the data sets change, the onDataSetsChange method will be invoked when the data sets change.

labelstring

The user readable-label for the action.

namestring

The action name.

supportProviderWidgetboolean

Whether the action can be used by the widget that provides the action.

widgetIdstring

The widget ID that provides the action. If no widget ID is provided, the action is provided by the framework.

icon

optional
Interface Property

id

Interface Property

intl

Interface Property

isWatchingDataSetsChange

optional
Interface Property

label

optional
Interface Property

name

optional
Interface Property

supportProviderWidget

optional
Interface Property

widgetId

optional
Interface Property

Methods

MethodReturnsNotes
destroy()void

This method will be invoked when the widget that provides the action is removed.

isSupported(dataSets, dataLevel, widgetId)Promise<boolean>

Will be invoked to determine whether the data action can process the data.

onDataSetsChange(dataSets, widgetId)void

This method will be invoked when the data sets change and the action is watching the data sets change. Please make sure check the widget ID before processing the data sets.

onExecute(dataSets, dataLevel, widgetId, actionConfig?)Promise<boolean | ReactElement<unknownstring | JSXElementConstructor<any>>>

This is the action logic.

destroy

Interface Method
destroy(): void

This method will be invoked when the widget that provides the action is removed.

Returns 
void

isSupported

Interface Method
isSupported(dataSetsDataRecordSet[], dataLevelDataLevel, widgetIdstring): Promise<boolean>

Will be invoked to determine whether the data action can process the data.

Parameters
ParameterTypeNotes
dataSetsDataRecordSet[]

The data sets that will be processed.

dataLevelDataLevel

The data level that will be processed.

widgetIdstring

The widget id that use the data actions.

Returns 
Promise<boolean>

onDataSetsChange

optional
Interface Method
onDataSetsChange(dataSetsDataRecordSet[], widgetIdstring): void

This method will be invoked when the data sets change and the action is watching the data sets change. Please make sure check the widget ID before processing the data sets.

Parameters
ParameterTypeNotes
dataSetsDataRecordSet[]

The data sets that will be processed.

widgetIdstring

The widget id that use the data actions.

Returns 
void

onExecute

Interface Method
onExecute(dataSetsDataRecordSet[], dataLevelDataLevel, widgetIdstring, actionConfig?any): Promise<boolean | ReactElement<unknownstring | JSXElementConstructor<any>>>

This is the action logic.

Parameters
ParameterTypeNotes
dataSetsDataRecordSet[]

The data sets that will be processed.

dataLevelDataLevel

The data level that will be processed.

widgetIdstring

The widget id that use the data actions.

actionConfigany

The action config that is set by the user. Not all actions have the config.

Returns 
Promise<boolean | ReactElement<unknownstring | JSXElementConstructor<any>>>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.