DataAction

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
() => void

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

string | IconResult

The action icon.

string

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

IntlShape

The Intl object for i18n.

(dataSetsDataRecordSet[], dataLevelDataLevel, widgetIdstring) => Promise<boolean>

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

string

The user readable-label for the action.

string

The action name.

(dataSetsDataRecordSet[], dataLevelDataLevel, widgetIdstring, actionConfig?any) => Promise<boolean | ReactElement<anystring | JSXElementConstructor<any>>>

This is the action logic.

string

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

destroy

Interface Property
destroy: () => void

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

Type declaration
    function(): void
    Returns 
    void

icon

optional
Interface Property
icon: string | IconResult

The action icon.

id

Interface Property
id: string

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

intl

Interface Property
intl: IntlShape

The Intl object for i18n.

isSupported

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

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

Type declaration
    function(dataSetsDataRecordSet[], dataLevelDataLevel, widgetIdstring): Promise<boolean>
    Parameters
    ParameterTypeNotes
    dataSets
    DataRecordSet[]

    The data sets that will be processed.

    dataLevel
    DataLevel

    The data level that will be processed.

    widgetId
    string

    The widget id that use the data actions.

    Returns 
    Promise<boolean>

label

optional
Interface Property
label: string

The user readable-label for the action.

name

optional
Interface Property
name: string

The action name.

onExecute

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

This is the action logic.

Type declaration
    function(dataSetsDataRecordSet[], dataLevelDataLevel, widgetIdstring, actionConfig?any): Promise<boolean | ReactElement<anystring | JSXElementConstructor<any>>>
    Parameters
    ParameterTypeNotes
    dataSets
    DataRecordSet[]

    The data sets that will be processed.

    dataLevel
    DataLevel

    The data level that will be processed.

    widgetId
    string

    The widget id that use the data actions.

    actionConfig
    any

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

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

widgetId

optional
Interface Property
widgetId: string

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

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