Embedded JS SDK API

Updated at:

This topic describes the APIs of the embedded JS SDK.

Feature parameters

The embed JS SDK uses four main properties for feature configuration: src, feature, events, and action.

Parameter

Description

Required

Example

src

Specifies the source of the embedded page, including the page to embed and its parameters.

Yes

Embeds the Dashboard Edit Page.

feature

Controls the visibility and display properties of components on the embedded page, such as text.

No

Hides the header of the embedded Quick BI page.

events

Defines event listeners for the embedded page.

No

Listens for a navigation event from the Dashboard Edit Page back to the Dashboard List.

action

Allows the host system to trigger actions on the embedded page.

No

Directs Quick BI to navigate to a new page.

src

The source information for the page to embed. Its type is EmbedSrcUnion, and it includes the following parameters:

Parameter

Type

Required

Description

src.page

EmbedRouteKey

Yes

In Quick BI, each work page and each tab on a list page can be considered a route. Examples include the dashboard preview page, dashboard edit page, and the dashboard list on the workbench.

This parameter specifies the route key for the page to embed. For example, to embed a dashboard preview page, set page to EmbedRouteKey.dashboardView. For a list of common route keys, see the Route key list.

src.origin

string

Yes

The origin used to access Quick BI, for example, https://bi.aliyun.com.

src.search

Record<string, string>

No

The query parameters for the embedded Quick BI page. Some pages require specific parameters to load correctly. For example, a workspace page requires a workspace ID, such as {workspaceId: 'your workspace ID'}. For the search parameters required by common pages, see the Route key list.

src.pathParams

Record<string, string>

No

The path parameters for the embedded Quick BI page. Currently, only a few pages require this parameter. For example, the data entry edit and preview pages require a work ID passed as a path parameter, such as pathParams: {id: 'your work ID'}.

Code example

<EmbedComponent
      src={
        origin: 'xxx',  // Quick BI host
        page: EmbedRouteKey.dashboardEdit,  // EmbedRouteKey for the dashboard edit page
        // Query parameters for the Quick BI dashboard page
        search: {
          workspaceId: 'xxx',  // workspace ID
          id: 'xxx',  // work ID
        }
      }
    />

Feature

An embed feature is a configuration that temporarily controls the visibility of page components and modifies display properties, like text. For example, you can hide the page header. Its type is EmbedFeatureIntersect, and it has a three-layer structure: route > functional module > feature configuration item. The key for the route layer is EmbedRouteKey, which defines the feature's scope. The sample code follows.

feature: {
  [routing key]: {
    [functional module]: {
      [feature configuration key]: value
    }
  }
}
The code block shows the configuration structure for a feature, where routing key, functional module, and feature configuration key are placeholders that you must replace with your specific values.

Additionally, some features follow a special two-layer structure: route > feature configuration item. This structure controls the visibility of the corresponding module. The following sample code demonstrates this.

feature: {
  [routing key]: {
    [feature configuration key]: value
  }
}

The routing parameters in the following table let you configure features for multiple routes at once.

Route key

Description

EmbedRouteKey.homeRoot

Controls the root page.

EmbedRouteKey.workspace

Controls the workspace page.

EmbedRouteKey.workPlatform

Controls the workbench page.

EmbedRouteKey.monitorManage

Controls the monitoring and alerting management page.

EmbedRouteKey.dashboardEdit

Controls the dashboard edit page.

EmbedRouteKey.workbookEdit

Controls the workbook edit page.

EmbedRouteKey.screenEdit

Controls the data screen edit page.

EmbedRouteKey.analysisEdit

Controls the ad hoc analysis edit page.

EmbedRouteKey.downloadEdit

Controls the self-service data retrieval edit page.

EmbedRouteKey.formEdit

Controls the data entry edit page.

EmbedRouteKey.etlEdit

Controls the data preparation edit page.

EmbedRouteKey.datasetEdit

Controls the dataset edit page.

EmbedRouteKey.workbookFormTask

Controls the workbook entry approval page.

EmbedRouteKey.dashboardView

Controls the dashboard preview page.

EmbedRouteKey.dashboardPublicView

Controls the dashboard public view page.

EmbedRouteKey.workbookView/EmbedRouteKey.workbookPublicView

Controls the workbook preview and public view pages.

EmbedRouteKey.analysisView/EmbedRouteKey.analysisPublicView

Controls the ad hoc analysis preview and public view pages.

EmbedRouteKey.downloadView/EmbedRouteKey.downloadPublicView

Controls the self-service data retrieval preview and public view pages.

EmbedRouteKey.subscriptionManage

Controls the subscription management page.

EmbedRouteKey.subscriptionTask

Controls the subscription task page.

EmbedRouteKey.sendRecord

Controls the sending history page.

EmbedRouteKey.orgAdmin

Controls the organization management page.

EmbedRouteKey.userMemberManage

Controls the member management page.

EmbedRouteKey.userGroupManage

Controls the user group management page.

EmbedRouteKey.userTagManage

Controls the user tag management page.

EmbedRouteKey.userTagDetailManage

Controls the user tag page.

EmbedRouteKey.tagManage

Controls the tag management page.

EmbedRouteKey.userRoleManage

Controls the role management page.

EmbedRouteKey.copilotPage

Controls the Q-Copilot page.

EmbedRouteKey.copilotPageQChat

Controls the Q-Chat page.

EmbedRouteKey.copilotPageQReport

Controls the Q-Report page.

EmbedRouteKey.copilotPageQReport

Controls the Q-Report edit page.

sample code

<EmbedComponent 
  feature={{
    [EmbedRouteKey.homeRoot]: {
      // workbench...
    },
    [EmbedRouteKey.dashboardEdit]: {
      // dashboard edit page...
    },
    // ...
  }} 
/>

EmbedRouteKey.homeRoot

homeRoot is the root page of Home. Its feature configurations are inherited by all its child pages. For example, if you hide the header on the homeRoot page, the header will also be hidden on child pages such as the workbench, workspace, template market, My dashboard, subscription management, and monitoring and alerts. The scope of attribute control is as follows.

image

  • header: Settings for the Home page header.

  • header.show

    • Type: boolean

    • Default value: true

    • Description: Shows or hides the header navigation on the Home page.

EmbedRouteKey.workspace

This section describes the control scope of each attribute in the workspace feature configuration.

image

  • header: Configures the workspace header.

  • header.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the workspace header.

  • goBack: Configures the "Return to Workbench" button.

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the "Return to Workbench" button.

  • goBack.text

    • Type: string

    • Default: 'Return to Workbench'

    • Description: Specifies the text of the "Return to Workbench" button.

  • switchWorkspace: Configures the "Switch Workspace" option.

  • switchWorkspace.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the "Switch Workspace" option.

  • breadcrumb: Configures the workspace breadcrumb.

  • breadcrumb.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the breadcrumb.

  • workspaceManageNavLabel: Configures the workspace management navigation label.

  • workspaceManageNavLabel.text

    • Type: string

    • Default: 'Workspace Management'

    • Description: Specifies the text of the workspace management navigation label.

  • sideNav: Configures the workspace side navigation.

  • sideNav.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the side navigation.

EmbedRouteKey.workPlatform

This section describes what each attribute in the Workbench feature configuration controls.

image

  • userInfo: Settings for the user information section on the workbench.

  • userInfo.show

    • Type: boolean

    • Default: true

    • Description: Controls whether the user information is displayed.

  • myWorkSpace: Settings for the My Workspace section on the workbench.

  • myWorkSpace.text

    • Type: string

    • Default: 'My Workspace'

    • Description: Specifies the custom text for My Workspace.

EmbedRouteKey.monitorManage

The following attributes are used to configure the features on the monitoring and alert management page.

image

  • gotoDashboard: Configures the 'Go to dashboard' feature on the monitoring and alerting page.

  • gotoDashboard.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the 'Go to dashboard' option.

EmbedRouteKey.dashboardEdit

This topic describes the properties for configuring features on the Dashboard Edit page and what each property controls.

image

  • goBack: Back button configuration.

  • goBack.show

    • Type: boolean

    • Default value: true

    • Description: Controls whether the back button is displayed.

  • publish: Publish button configuration.

  • publish.show

    • Type: boolean

    • Default value: true

    • Description: Controls whether the publish button is displayed.

  • saveAs: Save as button configuration.

  • saveAs.group

    • Type: 'state' | 'menu'

    • Default value: 'menu'

    • Description: Controls the location of the save as button. Set to 'menu' to place it in the more menu, or 'state' to place it in the save and publish status area.

  • saveAs.order

    • Type: number

    • Default value: -1

    • Description: Controls the order of the save as button within its button group.

  • saveAs.type

    • Type: 'default' | 'primary'

    • Default value: 'default'

    • Description: Sets the style of the save as button. This property applies only when the group is set to 'state'.

  • share: Share button configuration.

  • share.show

    • Type: boolean

    • Default value: true

    • Description: Controls whether the share button is displayed.

  • offline: Unpublish button configuration.

  • offline.show

    • Type: boolean

    • Default value: true

    • Description: Controls whether the unpublish button is displayed.

  • save: Save button configuration.

  • save.show

    • Type: boolean

    • Default value: true

    • Description: Controls whether the save button is displayed.

  • switchDataset: Dataset switching configuration.

  • switchDataset.disabled

    • Type: boolean

    • Default value: false

    • Description: Disables or enables dataset switching on the dashboard edit page.image

  • createDataset: Dataset creation configuration.

  • createDataset.show

    • Type: boolean

    • Default value: true

    • Description: Controls the visibility of the Create Dataset entry point in the dataset dropdown list and the data preview panel. If set to false, the entry point is hidden. If this option is not configured or is set to true, its visibility is still subject to page configuration and dataset creation permissions.

EmbedRouteKey.workbookEdit

The following properties configure features on the Workbook Edit page and define their scopes.image

  • goBack: Back button configuration.

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the back button.

  • publish: Publish button configuration.

  • publish.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the publish button.

  • saveAs: Save as button configuration.

  • saveAs.group

    • Type: 'state' | 'menu'

    • Default: 'menu'

    • Description: Specifies the group for the save as button. The value 'menu' places it in the more menu, while 'state' places it in the state area.

  • saveAs.order

    • Type: number

    • Default: -1

    • Description: Specifies the order of the save as button within its button group.

  • saveAs.type

    • Type: 'default' | 'primary'

    • Default: 'default'

    • Description: Specifies the style of the save as button. This property only takes effect when the button is in the 'state' group.

  • offline: Offline button configuration.

  • offline.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the offline button.

  • save: Save button configuration.

  • save.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the save button.

  • switchDataset: Dataset switching configuration.

  • switchDataset.disabled

    • Type: boolean

    • Default: false

    • Description: Specifies whether to disable dataset switching on the spreadsheet editing page.image

  • createDataset: Create dataset configuration.

  • createDataset.show

    • Type: boolean

    • Default: true

    • Description: Specifies the visibility of the "Create Dataset" entry in the dataset dropdown and the data preview panel. A value of false hides the entry. If set to true or omitted, visibility also depends on the page configuration and dataset creation permission.

EmbedRouteKey.screenEdit

The properties for configuring features on the large screen Edit page are as follows.image

  • goBack: Back button

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the Back button.

  • publish: Publish button

  • publish.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the Publish button.

  • saveAs: Save As button

  • saveAs.group

    • Type: 'state' | 'menu'

    • Default: 'menu'

    • Description: Determines the group for the save as button. 'menu' indicates that the button is in the more menu, and 'state' indicates that the button is in the save and publish status area.

  • saveAs.order

    • Type: number

    • Default: -1

    • Description: Specifies the order of the Save As button within its group.

  • saveAs.type

    • Type: 'default' | 'primary'

    • Default: 'default'

    • Description: Controls the style of the save as button. This parameter is valid only when the button belongs to the 'state' group.

  • share: Share button

  • share.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the Share button.

  • offline: Unpublish button

  • offline.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the Unpublish button.

  • save: Save button

  • save.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the Save button.

  • switchDataset: Switch dataset feature

  • switchDataset.disabled

    • Type: boolean

    • Default: false

    • Description: Specifies whether to disable the switch dataset feature on the screen editor page.image

  • createDataset: Create Dataset feature

  • createDataset.show

    • Type: boolean

    • Default: true

    • Description: Controls whether the Create Dataset entry point is displayed in the dataset dropdown and the data preview panel. If set to false, the entry point is hidden. If this parameter is not configured or is set to true, its display is still subject to page configuration and dataset creation permissions.

EmbedRouteKey.analysisEdit

The following attributes are used to configure features on the ad hoc analysis edit page.

image

  • goBack: Configures the back button

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the back button.

  • publish: Configures the publish button

  • publish.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the publish button.

  • saveAs: Configures the save as button

  • saveAs.group

    • Type: 'state' | 'menu'

    • Default: 'menu'

    • Description: Specifies the location of the save as button. A value of 'menu' places it in the more menu, and 'state' places it in the save and publish state area.

  • saveAs.order

    • Type: number

    • Default: -1

    • Description: Specifies the order of the save as button within its group.

  • saveAs.type

    • Type: 'default' | 'primary'

    • Default: 'default'

    • Description: Specifies the style of the save as button. This setting applies only when group is set to 'state'.

  • save: Configures the save button

  • save.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the save button.

  • switchDataset: Configures the switch dataset feature

  • switchDataset.disabled

    • Type: boolean

    • Default: false

    • Description: Enables or disables the switch dataset feature on the ad-hoc analysis edit page.

  • createDataset: Configures the create dataset feature

  • createDataset.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the 'Create Dataset' entry point in the dataset dropdown list and the data preview panel. When set to false, this entry point is hidden. Even if set to true or omitted, its visibility still depends on page configurations and dataset creation permissions.

EmbedRouteKey.downloadEdit

This page describes the feature configuration attributes on the ad-hoc query edit page and the scope of each.

image

  • goBack: Configures the back button.

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether the back button is displayed.

  • saveAs: Configures the save as button.

  • saveAs.group

    • Type: 'state' | 'menu'

    • Default: 'menu'

    • Description: Specifies the group of the save as button. Set to 'menu' to place the button in the more menu, or to 'state' to place it in the save and publish status area.

  • saveAs.order

    • Type: number

    • Default: -1

    • Description: Specifies the order of the save as button within its button group.

  • saveAs.type

    • Type: 'default' | 'primary'

    • Default: 'default'

    • Description: Specifies the style of the save as button. This property applies only when the group property is set to 'state'.

  • save: Configures the save button.

  • save.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether the save button is displayed.

  • switchDataset: Configures the switch dataset feature.

  • switchDataset.disabled

    • Type: boolean

    • Default: false

    • Description: Specifies whether to disable the switch dataset feature on the self-service data retrieval edit page.

  • createDataset: Configures the create dataset feature.

  • createDataset.show

    • Type: boolean

    • Default: true

    • Description: Specifies the visibility of the "create dataset" option in the dataset dropdown list and the data preview panel. Setting this property to false hides the option. If this property is omitted or set to true, visibility also depends on the page configuration and dataset creation permissions.

EmbedRouteKey.formEdit

This section details the feature configuration properties for the data entry edit page and their scope.

image

  • goBack: Settings for the Back button.

  • goBack.show

    • type: boolean

    • default value: true

    • description: Specifies whether to display the Back button.

  • save: Settings for the Save button.

  • save.show

    • type: boolean

    • default value: true

    • description: Specifies whether to display the Save button.

EmbedRouteKey.etlEdit

The following attributes are used to configure features on the data preparation edit page.

image

  • goBack: Configures the back button.

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the back button.

  • publish: Configures the publish button.

  • publish.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the publish button.

  • offline: Configures the unpublish button.

  • offline.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the unpublish button.

  • save: Configures the save button.

  • save.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the save button.

EmbedRouteKey.datasetEdit

The following properties control the feature configuration for the Dataset Edit page.

image

  • goBack: Configures the back button.

  • goBack.show

    • type: boolean

    • default value: true

    • Description: Controls whether the back button is displayed.

  • saveAs: Configures the save as button.

  • saveAs.group

    • type: 'state' | 'menu'

    • default value: 'menu'

    • Description: Specifies the group for the save as button, where 'menu' indicates the more menu and 'state' indicates the save and publish status area.

  • saveAs.order

    • type: number

    • default value: -1

    • Description: Controls the order of the save as button within its button group.

  • saveAs.type

    • type: 'default' | 'primary'

    • default value: 'default'

    • Description: This setting applies only when saveAs.group is 'state'.

  • save: Configures the save button.

  • save.show

    • type: boolean

    • default value: true

    • Description: Controls whether the save button is displayed.

EmbedRouteKey.workbookFormTask

This topic describes the attributes used to configure features on the spreadsheet submission and approval page, and the scope of each attribute.

image

  • header: Settings for the page header.

  • header.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the page header.

  • goBack: Settings for the back button.

  • goBack.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the back button.

EmbedRouteKey.dashboardView/EmbedRouteKey.dashboardPublicView

The following attributes configure features on the dashboard preview page and the dashboard public page.

image

  • title: Configures the dashboard title

  • title.show

    • Type: boolean

    • Default value: false

    • Description: Specifies whether to display the dashboard title. The title is hidden by default when the dashboard is embedded.

  • miniMenu: Configures the dashboard's mini menu

  • miniMenu.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the dashboard's mini menu.

  • cardMenu: Configures the chart card menu

  • cardMenu.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the chart card menu.

  • highlight: Configures the highlight effect for chart cards

  • highlight.componentIds

    • Type: string[]

    • Description: Specifies the IDs of the chart cards to highlight.

      Note

      You can obtain componentIds from the open API (Query the data lineage of a data artifact), or from the /api/v2/dashboard interface on the page.

EmbedRouteKey.workbookView/EmbedRouteKey.workbookPublicView

This section describes the feature configuration and property scope for the workbook preview page (workbookView) and the workbook public page (workbookPublicView).

image

  • download: spreadsheet export feature

  • download.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the entry point for the spreadsheet export feature.

  • offlineDownload: self-service data retrieval in spreadsheets

  • offlineDownload.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the entry point for self-service data retrieval in spreadsheets.

EmbedRouteKey.analysisView/EmbedRouteKey.analysisPublicView

The following attributes configure features on the ad hoc analysis preview page (analysisView) and the ad hoc analysis public page (analysisPublicView).image

  • download: Configures the ad hoc analysis export feature.

  • download.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the entry point for the ad hoc analysis export feature.

EmbedRouteKey.downloadView/EmbedRouteKey.downloadPublicView

This section describes the feature configuration and attribute control for the Workbook View (workbookView) and the Workbook Public View (workbookPublicView).

image

  • taskListPanel: The data retrieval task list panel.

  • taskListPanel.show

    • type: boolean

    • default value: true

    • description: Controls the visibility of the data retrieval task list panel.

EmbedRouteKey.subscriptionManage

The following attributes configure features on the subscription management page.

image

  • header: Settings for the header on the subscription management page.

  • header.show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the header on the subscription management page. This property overrides EmbedRouteKey.homeRoot.show.

EmbedRouteKey.subscriptionTask

On the subscription task page, the feature configuration has the following properties.image

  • show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the subscription task page.

EmbedRouteKey.sendRecord

The feature configuration for the sending record page includes the following attributes.

image

  • show

    • type: boolean

    • default value: true

    • description: Controls whether the sending records page is displayed.

EmbedRouteKey.orgAdmin

This section describes the features of the organization management page and the scope of its attribute control.

image

  • header: Properties for the header on the organization management page.

  • header.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the header on the organization management page. This property takes precedence over EmbedRouteKey.homeRoot.show.

  • sideNav: Properties for the side navigation on the organization management page.

  • sideNav.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the side navigation on the organization management page.

EmbedRouteKey.userMemberManage

The member management page displays the following attributes.

image

  • show

    • type: boolean

    • default value: true

    • description: Controls whether the member management page is displayed.

User group management

The user group management page lists the following attributes.

image

  • show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the user group management page.

EmbedRouteKey.userTagManage

The User Tag Management page has the following attributes.

image

  • show

    • type: boolean

    • default value: true

    • description: A two-level property that shows or hides the User Tag Management Page.

EmbedRouteKey.userTagDetailManage

The user tag page has the following attributes.

image

  • show

    • type: boolean

    • default value: true

    • description: Shows or hides the user tag page.

EmbedRouteKey.tagManage

The tag management page has the following properties.

image

  • show

    • Type: boolean

    • Default: true

    • Description: Specifies whether to display the tag management page.

EmbedRouteKey.userRoleManage

The role management page has the following attributes.

image

  • show

    • Type: boolean

    • Default: true

    • Description: Controls whether the role management page is displayed.

EmbedRouteKey.copilotPage

The Intelligent Advisor page has the following properties.

image

  • header: Configures the header of the Smart Assistant Q page.

  • header.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the header. This property takes precedence over EmbedRouteKey.homeRoot.header.show.

  • sideNav: Configures the side navigation of the Smart Assistant Q page.

  • sideNav.show

    • Type: boolean

    • Default value: true

    • Description: Specifies whether to display the side navigation.

  • theme: Configures the theme of the Smart Assistant Q page.

  • theme.primaryColor

    • Type: string

    • Default value: #2F66FF

    • Description: Specifies the primary color for the theme.

  • theme.chartColorSeries

    • Type: string[]

    • Default value: [

      '#4080FF',

      '#3DC8DC',

      '#A191F2',

      '#FFB77A',

      '#7C7CA6',

      '#33CC99',

      '#217CCC',

      '#FF80AA',

      '#008770',

      '#D1876F',

      '#4798B3',

      '#C896FA']

    • Description: Specifies the color series for charts.

EmbedRouteKey.copilotPageQChat

The Intelligent Q&A page inherits all features from EmbedRouteKey.copilotPage and has a higher priority. It also includes the following properties.image

  • dataInterpretation: Configures the data interpretation feature in Intelligent Query.

  • dataInterpretation.show

    • Type: boolean

    • Default: true

    • Description: Shows or hides the data interpretation feature on the Intelligent Query page.

EmbedRouteKey.copilotPageQReport

The Q-Report page inherits all features from EmbedRouteKey.copilotPage and has a higher priority.

EmbedRouteKey.wordAgentEdit

The Q Report edit page has the following properties.image

  • goBack: Settings for the Xiao Q Report's back button.

  • goBack.show

    • Type: boolean

    • Default value: true

    • Description: Controls the visibility of the back button on the Xiao Q Report edit page.

Events

A configuration object that listens for events from the embedded page. The host system can handle these events to capture actions and respond accordingly.

The following events are available:

Event name

Description

Before page change event

before-page-change-event

Triggered before navigating from a Quick BI page to a new one. This allows you to listen for all navigation actions within the application, such as navigating from the dashboard list to the dashboard edit page.

After component rendered event

after-component-rendered-event

Triggered after a chart is rendered on pages such as the dashboard preview or edit page. For example, on a dashboard preview page, Quick BI uses lazy loading for charts to improve performance. As you scroll, this event triggers for any chart that enters the viewport.

before-page-change-event

Description: This event triggers before navigating from a Quick BI page to a new one, such as from a dashboard list page to a dashboard edit page.

The callback for this event receives an EmbedEventBeforePageChange object.

type EmbedEventBeforePageChange = {
  type: EmbedEventType['before-page-change-event'],
  payload: {
    src: EmbedSrcUnion,
    target: '_blank' | '_self'
  }
}
  • event.payload.src: The source information of the page to navigate to. For more information, see src.

  • event.payload.target: Specifies how to open the new page. _blank opens the page in a new window, while _self opens it in the current window.

return: Returning false from the event handler prevents the default Quick BI navigation.

embedClient.on(EmbedEventType['before-page-change-event'], async (event: EmbedEventBeforePageChange) => {
  // Prevent navigation to a new page.
  if (event.payload.target === '_blank') {
    return false;
  }
})

after-component-rendered-event

Description: Triggered after a chart is rendered on pages such as the dashboard preview or edit page. For example, on a dashboard preview page, Quick BI uses lazy loading for charts to improve performance. As you scroll, this event triggers for any chart that enters the viewport.

The callback for this event receives an EmbedEventAfterComponentRendered object.

type EmbedEventAfterComponentRendered = {
  type: EmbedEventType['after-component-rendered-event'],
  customProps: ComponentProps
}

The customProps object contains information about the chart and the page. Its interface is defined as follows:

export interface ComponentProps {
  status?: 'success' | 'error';
  error?:
    | ComponentError
    | ComponentConfigError
    | ComponentNoPermissionError
    | ComponentDataMaskError
    | ComponentNoDataError
    | ComponentRenderError;
  pageConfig?: ComponentPageConfig;
  id: string;
  data: DataCell[][];
  dataConfig: AreaModel[];
  viewConfig: ComponentPropsViewConfig;
  advancedConfig: object;
  globalConfig: ComponentPropsGlobalConfig;
  cubeConfig?: ComponentPropsCubeConfig[];
  sql?: string[];
}
  • customProps.status

    The rendering status of the chart component. The value is success if the component renders correctly and error otherwise.

  • customProps.error

    The error details if a chart component fails to render. There are six error categories, with ComponentError representing an unknown error.

    /** Defaults to 'ComponentError' for unknown errors. */
    export interface ComponentError<T extends string = 'ComponentError'> {
      /** The error name, used for type identification. */
      name: T;
      /** The error message. */
      message?: string;
    }
    
    /** Error related to chart configuration. */
    export type ComponentConfigError = ComponentError<'ComponentConfigError'>;
    
    /** Error related to permissions. */
    export type ComponentNoPermissionError = ComponentError<'ComponentNoPermissionError'>;
    
    /** Error related to data masking. */
    export type ComponentDataMaskError = ComponentError<'ComponentDataMaskError'>;
    
    /** Error indicating that no data is available. */
    export type ComponentNoDataError = ComponentError<'ComponentNoDataError'>;
    
    /** Error related to rendering. */
    export type ComponentRenderError = ComponentError<'ComponentRenderError'>;
  • customProps.pageConfig

    Contains information about the page hosting the component.

    interface CustomEventPageConfig {
      /** The workspace ID of the page. */
      workspaceId: string;
      /** The ID of the page. */
      id: string;
      /** The page mode. Valid values: 'preview', 'edit', 'snapshot' (for dashboards and spreadsheets only), or 'public' (for data screens). */
      mode: 'preview' | 'edit' | 'snapshot' | 'public';
      /** The current device. */
      device: 'pc' | 'mobile';
      /** The ID of the current visitor. */
      userId: string;
      /** The username of the current visitor. */
      userName: string;
      /** The nickname of the current visitor. */
      nickName?: string;
      /** The ID of the page owner. */
      ownerUserId: string;
      /** The username of the page owner. */
      ownerUserName: string;
      /** The title of the page. */
      title: string;
      /** The type of the page. 'webExcel' corresponds to a spreadsheet, and 'screen' corresponds to a data screen. */
      pageType: 'dashboard' | 'webExcel' | 'screen' | 'offline' | 'analysis';
    }
  • customProps.id

    The instance ID of the component.

  • customProps.data

    The rendering data for the chart component, structured as a two-dimensional array.

    interface DataCell {
      fieldId: string;
      originValue: string;
      value: string;
      geoInfo?: object;
    }
    • fieldId: The ID of the data field, which corresponds to an ID in dataConfig.

    • originValue: The original data value.

    • value: The formatted data value for display.

    • geoInfo: The geographic information for a dimension field.

  • customProps.dataConfig

    The data field configuration from the chart's data panel. Its interface is defined as follows:

    interface AreaModel {
      areaType: 'row' | 'column' | 'drill' | 'filter';
      fields: FieldModel[];
    }
    • areaType: The type of field. Valid values are:

      • row: A dimension field.

      • column: A measure field.

      • drill: A drill-down field.

      • filter: A filter field.

    • fields: An array of fields. You can have multiple fields of the same type.

      interface FieldModel {
        /** The unique ID of the field. */
        fieldId: string;
        /** The name of the field. */
        fieldName: string;
        /** The display alias. */
        showName: string;
        /** Indicates whether it is a calculated field. */
        isCalc?: boolean;
        /** For example, 'calc'. */
        skin?: string;
        /** The type of the value. */
        valueType?: FieldValueType;
        /** The type of the field: dimension or measure. */
        fieldType: FieldCommonType;
        /** The aggregation method. */
        aggregation?: FieldAggregation | string;
        /** The data rendering format. 'imageUrl' is used for rendering images in pivot tables and leaderboards. */
        displayType?: 'imageUrl' | '';
        /** The dataset format configuration, such as '#,##0.00%'. */
        rawFormat?: string;
        dimGranularity?: any;
        format?: QbiFormatModel | FbiFormatModel;
        /** The sort order. */
        order?: FieldOrder;
        /** Advanced calculation: YoY and MoM comparison. */
        advancedCalculation?: 'year-to-year' | 'month-to-year';
        /** The collection of filter conditions for the current chart. */
        complexFilter: {
          limitNum: number;
          filter: any;
        };
        // The actual unique identifier for the field.
        uuid: string;
        /** Special extended information for fields in different charts. */
        extends?: FieldModelExtends;
      }
  • customProps.viewConfig

    The style configuration for the chart.

    interface ComponentPropsViewConfig {
      caption?: string;
      chartColorSeries?:  {
        key: string;
        name: string;
        colors: string[];
      };
      chartSkin?: {
        key: 'black' | 'default';
      };
      title?: {
        show: boolean;
        viceName?: string;
        color?: string;
        showLink?: boolean;
        link?: string;
        linkName?: string;
      };
      fieldSettingMap?: { [fieldId: string]: ComponentPropsFieldSettingConfig };
      width?: number;
      height?: number;
      [key: string]: any;
    }
    • caption: The component caption.

    • title: The component title configuration.

      • title.show: Indicates whether to show the caption and notes.

      • title.viceName: Caption notes.

      • title.color: Caption color.

      • title.showLink: Whether to show a link.

      • title.link: The link URL.

      • title.linkName: The link label.

    • chartColorSeries: The dashboard theme color series.

      • chartColorSeries.key: The key for the theme color series.

      • chartColorSeries.name: The name of the theme color series.

      • chartColorSeries.colors: The 10 colors in the theme series.

    • chartSkin: The dashboard skin.

    chartSkin.key: The key for the dashboard skin.

    • default represents the light theme.

    • black represents the dark theme.

    • fieldSettingMap: Stores field display settings, such as field aliases and number formats. Its interface is:

      interface ComponentPropsFieldSettingConfig {
        aliasName: string;
        numberFormat: NumberFormat;
        [key: string]: any;
      }
    • height: The custom height of the chart.

    • width: The custom width of the chart.

  • customProps.globalConfig

    The global configuration data for the chart.

  • customProps.advancedConfig

    The configuration from the chart's advanced panel.

  • customProps.cubeConfig

    The chart's dataset configuration, structured as an array of objects.

    interface ComponentPropsCubeConfig {
      /** The dataset ID. */
      cubeId: string;
      /** The dataset name. */
      cubeName: string;
    }
  • customProps.sql

    The SQL queries for the chart, structured as an array of strings.

Action

An action is a configuration object that defines the interactions between the host system and the embedded page. It enables the host to programmatically trigger behaviors on the embedded page, such as navigating to a new page or updating features. The following actions are available.

Action

Description

Route Navigation

embedNavigate

Navigates the embedded page to a specified route.

Update Embed Feature

setEmbedFeature

Updates the feature configuration of the embedded page.

Scroll Page

scrollToComponentById

On a dashboard preview or public page, scrolls the embedded page to a specified chart component.

Get Download Config

getDownloadConfig

Gets the supported export formats for the current embedded page.

Applicable to dashboards, spreadsheets, ad-hoc analysis, and self-service data retrieval.

Trigger Download

triggerDownload

Triggers an export download.

For dashboards, spreadsheets, and ad-hoc analysis, this initiates a synchronous file download. For self-service data retrieval, this creates an asynchronous fetch task.

Get Chart Component Tree

getComponentsTree

Gets the tree structure of chart components in a dashboard, which is used to select specific charts for a Partial Excel Export.

Applicable only to dashboards.

Get Fetch Task List

getFetchTaskList

Gets the list of fetch tasks for the current self-service data retrieval artifact.

Applicable only to self-service data retrieval pages.

Trigger Fetch Task Download

triggerFetchTaskDownload

Downloads the file for a specified fetch task.

Applicable only to self-service data retrieval pages.

enum EmbedActionType {
  /** Route navigation */
  embedNavigate = 'embedNavigate',
  /** Update embed feature */
  setEmbedFeature = 'setEmbedFeature',
  /** Scroll page to a specified component */
  scrollToComponentById = 'scrollToComponentById',
  /** Get download configuration */
  getDownloadConfig = 'getDownloadConfig',
  /** Trigger download */
  triggerDownload = 'triggerDownload',
  /** Get the chart component tree */
  getComponentsTree = 'getComponentsTree',
  /** Get the list of fetch tasks */
  getFetchTaskList = 'getFetchTaskList',
  /** Trigger a fetch task file download */
  triggerFetchTaskDownload = 'triggerFetchTaskDownload',
}

embedNavigate

  • Description: Navigates the embedded page to a specified route.

  • payload.src: The source information for the destination route. For more information, see src.

    type EmbedActionNavigate = {
      type: EmbedActionType.embedNavigate;
      payload: {
        src: EmbedSrcUnion;
      }
    }
  • Example

    // Navigate to the dashboard edit page.
    embedClient.dispatch({
      type: EmbedActionType.embedNavigate,
      payload: {
        src: {
          origin: 'https://bi.aliyun.com',
          page: EmbedRouteKey.dashboardEdit,
          search: {
            workspaceId: 'xx',
            id: 'xx'
          },
        },
      },
    });

setEmbedFeature

  • Description: Updates the feature configuration of the embedded page.

  • payload: The page-specific feature configuration. For more information, see feature.

    type EmbedActionSetFeature = {
      type: EmbedActionType.setEmbedFeature;
      payload: EmbedFeatureIntersect;
    }
  • Example

    embedClient.dispatch({
      type: EmbedActionType.setEmbedFeature,
      payload: {
        // Hide the back button on the dashboard edit page.
        [EmbedRouteKey.dashboardEdit]: {
          goBack: {
            show: goBack,
          },
        },
      },
    });

scrollToComponentById

  • Description: Scrolls the embedded page to a specified chart component on a dashboard preview or public page.

  • payload

    • payload.id: The ID of the component to scroll to.

    • payload.position: The position of the component after scrolling.

type EmbedActionScrollToComponentById = {
  type: EmbedActionType.scrollToComponentById,
  payload: {
    id: string;
    position: 'start' | 'center' | 'end' | 'nearest'
  }
}

Example:

embedClient.dispatch({
  type: EmbedActionType.scrollToComponentById,
  payload: {
    // Scroll the dashboard preview page to the specified component ID.
    id: 'scroll to this component id',
    // The component will be centered on the screen after scrolling.
    position: 'center',
  },
});

getDownloadConfig

  • Description: Gets the supported export formats for the current embedded page. This action applies to dashboards, spreadsheets, ad-hoc analysis, and self-service data retrieval.

  • Return value

    • formats: An array of available export formats for the current page. Possible values include:

      • Dashboard: 'excel', 'image', 'pdf'

      • Spreadsheet: 'excel', 'pdf'

      • Ad-hoc analysis: 'excel', 'image'

      • Self-service data retrieval: 'excel', 'excelWithFormat', 'csv', 'csvWithFormat'

    /** Embedded action - get download configuration */
    type EmbedActionGetDownloadConfig = {
      type: EmbedActionType.getDownloadConfig;
    }
    
    /** Return value */
    type GetDownloadConfigResult = {
      formats: string[];
    }
  • Example:

    const config = await embedClient.dispatch({ type: EmbedActionType.getDownloadConfig });
    
    console.log(config.formats); // ['excel', 'image', 'pdf']

triggerDownload

  • Description: Triggers an export download. For a dashboard, spreadsheet, or ad-hoc analysis, this action initiates a synchronous file download. For self-service data retrieval, it creates an asynchronous fetch task.

  • payload

    • payload.format: Required. The export format. The available values depend on the module type. To get the list of supported formats, use the getDownloadConfig action.

    • payload.contentList: Used only for dashboard Excel exports. Specifies an array of component IDs to export. If this parameter is omitted, the entire dashboard is exported. Use getComponentsTree to get the list of available components.

    • payload.taskName: Used only for self-service data retrieval. Specifies the name of the fetch task. If this parameter is omitted, a default name is generated.

    /** Embedded action - trigger download */
    type EmbedActionTriggerDownload = {
      type: EmbedActionType.triggerDownload;
      payload: {
        /**
         * Export format.
         * - Dashboard, spreadsheet, or ad-hoc analysis: 'excel' | 'image' | 'pdf'
         * - Self-service data retrieval: 'excel' | 'excelWithFormat' | 'csv' | 'csvWithFormat'
         */
        format: 'excel' | 'image' | 'pdf' | 'excelWithFormat' | 'csv' | 'csvWithFormat';
        /** For dashboard Excel exports, an array of component IDs to export. If omitted, all components are exported. */
        contentList?: string[];
        /** The name of the fetch task for self-service data retrieval. If omitted, a default name is used. */
        taskName?: string;
      }
    }
    
    /** Return value */
    type TriggerDownloadResult = {
      success: boolean;
    }
  • Example:

    // Dashboard - Export the entire dashboard to Excel.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: { format: 'excel' },
    });
    
    // Dashboard - Export specific charts to Excel. You must first get the component IDs by using getComponentsTree.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: {
        format: 'excel',
        contentList: ['component-id-1', 'component-id-2'],
      },
    });
    
    // Dashboard - Export as an image.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: { format: 'image' },
    });
    
    // Dashboard - Export as a PDF.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: { format: 'pdf' },
    });
    
    // Spreadsheet - Export to Excel.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: { format: 'excel' },
    });
    
    // Ad-hoc analysis - Export as an image.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: { format: 'image' },
    });
    
    // Self-service data retrieval - Create a fetch task.
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: {
        format: 'excel',
        taskName: 'My Fetch Task',
      },
    });

getComponentsTree

  • Description: Gets the tree structure of chart components within a dashboard. This allows users to select specific charts for a Partial Excel Export. This action applies only to dashboards.

  • Return value

    • components: The tree of chart components, sorted according to the dashboard layout.

    • type: The chart type identifier. You can use this to filter and export only specific chart types, such as a detail table (detail_table) or a cross table (cross_table). Child items under a TAB component do not have a type.

    • disabled: If true, the node represents a non-chart item (such as a filter or text element) and cannot be selected for export.

    /** Embedded action - get the chart component tree */
    type EmbedActionGetComponentsTree = {
      type: EmbedActionType.getComponentsTree;
    }
    
    /** Return value */
    type GetComponentsTreeResult = {
      components: Array<{
        /** Component ID to be passed to triggerDownload.contentList */
        id: string;
        /** Component title */
        title: string;
        /** Chart type, such as 'line', 'bar', 'cross_table', or 'detail_table' */
        type?: string;
        /** Child components, such as charts within a TAB container */
        children?: Array<...>;
        /** Indicates whether the component is disabled. Non-chart types cannot be selected for export. */
        disabled?: boolean;
      }>;
    }
  • Example:

    // Get the chart component tree.
    const tree = await embedClient.dispatch({
      type: EmbedActionType.getComponentsTree,
    });
    
    console.log(tree.components);
    // [
    //   { id: 'chart-1', title: 'Sales Trend', type: 'line', disabled: false },
    //   { id: 'chart-2', title: 'Regional Distribution', type: 'cross_table', disabled: false },
    //   { id: 'tab-1', title: 'TAB Container', children: [
    //     { id: 'chart-3', title: 'Detailed Data', disabled: false },
    //   ]},
    //   { id: 'filter-1', title: 'Date Filter', disabled: true },
    // ]
    
    // Use with triggerDownload to export only cross tables and detail tables.
    const tableIds = tree.components
      .filter(node => !node.disabled && ['cross_table', 'detail_table'].includes(node.type))
      .map(node => node.id);
    
    await embedClient.dispatch({
      type: EmbedActionType.triggerDownload,
      payload: { format: 'excel', contentList: tableIds },
    });

getFetchTaskList

  • Description: Gets the list of fetch tasks for the current self-service data retrieval artifact. This action applies only to self-service data retrieval pages.

  • Return value

    • tasks: A list of fetch tasks.

    • status: The task status. Possible values are:

      Status

      Description

      canDownload

      0

      In Progress

      false

      1

      Completed

      true

      2

      Failed

      false

      3

      Pending Approval

      false

      4

      Rejected

      false

      5

      Downloaded

      true

  • payload.keyword: Optional. A keyword for a fuzzy search on task names.

  • Example:

    // Get all tasks.
    const res = await embedClient.dispatch({
      type: EmbedActionType.getFetchTaskList,
    });
    
    console.log(res.tasks);
    // [
    //   { downloadId: 'xxx', downloadName: 'Sales Data', status: 1, gmtCreate: '2025-06-01 10:00', canDownload: true },
    //   { downloadId: 'yyy', downloadName: 'Inventory Report', status: 0, gmtCreate: '2025-06-01 11:00', canDownload: false },
    // ]
    
    // Search by keyword.
    const filtered = await embedClient.dispatch({
      type: EmbedActionType.getFetchTaskList,
      payload: { keyword: 'Sales' },
    });
    

triggerFetchTaskDownload

  • Description: Downloads the file for a specified fetch task. This action can be used only when a task's canDownload property is true (the status is 'Completed' or 'Downloaded'). This action is supported only on self-service data retrieval pages.

/** Embedded action - trigger fetch task file download */
type EmbedActionTriggerFetchTaskDownload = {
  type: EmbedActionType.triggerFetchTaskDownload;
  payload: {
    /** The ID of the fetch task, obtained from the downloadId returned by getFetchTaskList. */
    downloadId: string;
  }
}

/** Return value */
type TriggerFetchTaskDownloadResult = {
  success: boolean;
}
  • payload

    payload.downloadId: The ID of the fetch task. Required. The value is from the response of getFetchTaskList, specifically the downloadId field.

  • Example

    // Download a specified task.
    const result = await embedClient.dispatch({
      type: EmbedActionType.triggerFetchTaskDownload,
      payload: { downloadId: 'xxx' },
    });
    
    console.log(result.success); // true
    

Development methods

How you configure an embedded page's source, features, and other properties with the JS SDK depends on the development environment. In a plain JavaScript environment (without a framework), you must use the EmbedClient class to create a client instance and then configure it. In framework environments like React and Vue, you configure the embedding source by rendering the EmbedComponent component.

The following sections describe how to use the EmbedClient class and the EmbedComponent component to customize an embedded page.

EmbedClient

Use the following methods of the EmbedClient class to customize an embedded page.

Method

Description

constructor

Creates a new client instance.

render

Renders the client instance into a DOM container.

destroy

Destroys the client instance and removes the embedded page.

dispatch

Triggers an embed action.

on

Registers an event listener.

off

Unregisters an event listener.

constructor

Creates a new client instance.

  • Type: (src: EmbedSrcUnion, option?: Partial<PostMessengerParam>) => void

  • Parameters

    • src: The embedding source that specifies the page to embed. For more information, see src.

    • option: Configuration options for the client.

      • option.connectTimeout: Connection timeout.

      • option.messageTimeout: Message timeout.

  • Sample code

    const embedClient = new EmbedClient({
      src: {
        origin: 'https://bi.aliyun.com',
        page: EmbedRouterKey.dashboardView,
      },
      option: { connectTimeout: 5000 }
    });

render

Renders the client instance into a DOM container.

  • Type: (container: HTMLIframeElement) => HTMLIFrameElement

  • Parameter

    • container: The DOM container for the embedded page.

  • Sample code

    embedClient.render(document.getElementById('embed-container'));

destroy

Destroys the client instance and removes the embedded page.

  • Type: () => void

  • Sample code

    embedClient.destroy();

dispatch

Triggers an embed action.

  • Type: (action: EmbedAction) => Promise<T>

  • Parameter

    • action: The embed action to dispatch. For more information, see action.

  • Sample code

    // Hide the back button on the dashboard edit page
    embedClient.dispatch({
      type: EmbedActionType.setEmbedFeature,
      payload: {
        [EmbedRouteKey.dashboardEdit]: {
          goBack: {
            show: goBack,
          },
        },
      },
    });

on

Registers an event listener.

  • Type: on(eventType: EmbedEventType, listener: (event: T) => Promise<T>)

  • Parameters

    • eventType: The event type, EmbedEventType.

    • listener: The event callback, which supports asynchronous functions. The input parameters and return values vary by event. For more information, see events.

  • Sample code

    // Before page change event
    async handler(event: EmbedEventBeforePageChange) => {
      return false;
    }
    
    // Bind the event
    embedClient.on(EmbedEventType['before-page-change-event'], handler); 

off

Unregisters an event listener.

  • Type: off(eventType: EmbedEventType, listener).

  • Parameters

    • eventType: The event type, EmbedEventType.

    • listener: The event listener to unregister.Events

  • Sample code

    async handler function(payload) {}
    
    // Unbind the event
    embedClient.off(EmbedEventType['before-page-change-event'], handler);

EmbedComponent

To embed a page in React or Vue, render the EmbedComponent component. Its props are defined below. Updating the component's props automatically re-renders the page.

interface EmbedComponentCommonProps {
  /** The class name of the container. */
  className?: string;
  /** The style of the container. */
  style?: CSSProperties;
  /** The embedding source information. */
  src: EmbedSrcUnion;
  /** The initial feature configuration for the embedding. */
  feature?: EmbedFeatureIntersect;
  /** The initial event listener for the embedding. */
  events?: EmbedEventListenerUnion;
}

The following table describes these props.

Parameter

Type

Required

Description

props.className

string

No

The CSS class name for the component's root element.

props.style

CSSProperties

No

The inline CSS styles for the component's root element.

props.src

EmbedSrcUnion

Yes

The embedding source information for the Quick BI page. For more information, see src.

props.feature

EmbedFeatureIntersect

No

The initial feature configuration for the embedding. For more information, see feature.

props.events

EmbedEventListenerUnion

No

The initial event listeners for the embedding. For more information, see events.

References

  • See the code sample to learn how to use the embedded SDK.