Custom Widget JSON Reference
The custom widget JSON file specifies the custom widget.
The following sections explain the valid properties of the custom widget JSON. Any other properties present in a custom widget JSON render it invalid.
Root Object
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
id |
Required |
String |
Unique ID of the custom widget, for example, "com.sap.sample.coloredbox" |
|
version |
Required |
String |
Version of the custom widget, for example, "1.0.0" |
|
name |
Required |
String |
Name of the custom widget, for example, "Colored Box" |
|
description |
Optional |
String |
Description of the custom widget, which is used, for example, in tooltips |
|
newInstancePrefix |
Required |
String |
Prefix of a new custom widget instance in a story experience, for example, "ColoredBox" |
|
icon |
Optional |
String |
URL of the custom widget’s icon (16 x 16 pixels). |
|
vendor |
Optional |
String |
Vendor string |
|
eula |
Optional |
String |
End-user license agreement text |
|
license |
Optional |
String |
License text |
|
webcomponents |
Required |
Array of Webcomponent objects |
Web components of the custom widget (see section below) |
|
properties |
Required |
Properties object |
Properties of the custom widget (see section below) |
|
methods |
Required |
Methods object |
Methods of the custom widget (see section below) |
|
events |
Required |
Events object |
Events of the custom widget (see section below) |
|
imports |
Optional |
Array of strings |
Type libraries used by the custom widget (see chapter Importing Script API Data Types with Type Libraries) |
|
supportsMobile |
Optional |
Boolean |
Indicates whether the custom widget is rendered on mobile devices. If false, then the custom widget is replaced in a story on a mobile device by a placeholder with a message explaining that the custom widget doesn’t run on a mobile device. See Custom Widgets on Mobile Devices for more information.
Possible values are:
|
|
supportsExport |
Optional |
Boolean |
Indicates whether the custom widget supports PDF export. |
|
supportsLinkedAnalysisFilterOnSelection |
Optional |
Boolean |
Indicates whether the custom widget supports linked analysis based on Filter on Data Point Selection. In addition, within your Web Component JavaScript file, you need to use Data Binding's linked analysis APIs so that a selected data point from the custom widget can filter other widgets. For more information, refer to Enabling Linked Analysis for Your Custom Widget. |
|
supportsViewportLoading |
Optional |
Boolean |
Indicates whether the custom widget supports viewport loading. For more information, refer to Enabling Viewport Loading for Your Custom Widget. |
|
supportsBookmark |
Optional |
Boolean |
Indicates whether the custom widget supports bookmark. For more information, refer to Configuring Bookmark Support for Your Custom Widget. |
|
supportsLWV |
Optional |
Boolean |
Indicates whether the custom widget can be viewed in Lite Viewer. For more information, refer to Enabling Lite Viewer Support for Your Custom Widget |
|
supportsVisualization |
Required |
Boolean |
Indicates whether the custom widget renders a data visualization (chart, graph). |
|
types |
Optional |
Types object |
Custom types of the custom widget. You can define your own data structures and enumerations here (see section below). |
|
dataBindings |
Optional |
DataBindings object |
Data bindings of the custom widget. You can define your own data bindings with an array of feed objects here (see section below). |
Webcomponent Object
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
kind |
Required |
String |
What kind of component this Web Component represents.
Possible values are:
|
|
tag |
Required |
String |
Unique name of the custom element (its HTML tag name) of this Web Component. |
|
url |
Required |
String |
URL to the Web Component JavaScript file |
|
type |
Optional |
String |
This property can help with the modularization of your JavaScript code. For more information, see the description of the type attribute with the value module in the Mozilla MDN webdocs on the script element. |
|
integrity |
Required |
String |
String containing the hash value of the Web Component JavaScript file. The hash value has the format "hashAlgorithm-hashValue", for example, "sha256-ih2Us20RAQ9CaWjbO/LfZPetSX7gTrVlTtbdF6mk4io=" Web browsers support several hash algorithms. For more information, see the Mozilla MDN web docs on Subresource Integrity. |
|
ignoreIntegrity |
Optional |
Boolean |
Indicates whether to ignore the property integrity, for example, during development of a custom widget.
Possible values are:
|
Properties Object
|
Properties |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
type |
Required |
String |
Type of the custom widget property.
Possible values are, for example:
|
|
description |
Optional |
String |
Description of the custom widget property |
|
default |
Optional |
Depending on type |
Default value of the custom widget property.
Possible values are one of the following JavaScript types:
|
Methods Object
|
Properties |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
description |
Required |
String |
Description of the script method |
|
parameters |
Optional |
Array of Parameter objects |
Parameters of the script method (see section below). Omit this property if the script method has no parameters. |
|
body |
Optional |
String |
Implementation of the script method expressed in the SAP Analytics Cloud script language. |
|
returnType |
Optional |
String |
Return type of the script method. Omit this property if the script method has no return value. |
Parameter Object
|
Properties |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
name |
Required |
String |
Name of the parameter |
|
type |
Required |
String |
Type of the parameter.
Possible values are, for example:
|
|
description |
Optional |
String |
Description of the parameter |
Events Object
|
Properties |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
descripton |
Optional |
String |
Description of the event |
Types Object
A Types object specifies the custom types of a custom widget. Custom types can be either custom data structures or custom enumerations. They can be used as types for properties, arguments and return types of methods inside the custom widget JSON. In the analytic application or optimized story you can use custom types for global variables, script object function arguments and return types.
Each JSON property name of a Types object is the name of a custom type. Its value defines the custom type property, either a custom data structure or a custom enumeration.
To avoid clashes of custom type names, internally each custom type name is made unique by using a qualified custom type name, which contains the custom widget ID. You don’t need to specify the qualified custom type name in the types property section.
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
description |
Optional |
String |
Description of the data structure |
|
extends |
Optional |
String |
The data structure to extend. You can extend your own custom data structures, but not custom enumerations and simple types (string, number, integer, boolean). |
|
properties |
Required |
Array of CustomTypeProperty objects |
Properties of the data structure (see section CustomTypeProperty). |
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
description |
Optional |
String |
Description of the enumeration |
|
extends |
Required |
String |
Possible value:
This marks the type as an enumeration. |
|
properties |
Required |
Array of CustomEnumValue objects |
Values of the enumeration (see section CustomEnumValue). |
CustomTypeProperty
A CustomTypeProperty object specifies one property of a custom type of a custom widget. Its JSON properties are:
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
name |
Required |
String |
Name of the property |
|
description |
Optional |
String |
Description of the type |
|
type |
Required |
String |
The type of the property. This can be a simple type (string, number, integer, boolean), an enumeration, or a type that can be used as an argument type or as an object expression. |
|
mandatory |
Optional |
Boolean |
Defines this property as mandatory. You must specify this property when creating instances of this type. |
CustomEnumValue
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
name |
Required |
String |
Name of the enumeration value |
|
description |
Optional |
String |
Description of the enumeration value |
DataBindings Object
You can specify the data binding of your custom widget in the dataBindings property. You can define only one object, and only the first one will be used if you define multiple objects.
The keys of the dataBindings property represent the name of the object.
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
feeds |
Required |
Array of Feed objects |
Feeds of DataBindings (see section below) |
Also a default Builder panel will be available in design time if you define a DataBindings object in the JSON file. If you've specified your own Builder panel via the Webcomponent object, this automatically generated panel won't be used.
Feed Object
|
Property |
Required/Optional |
Type |
Description |
|---|---|---|---|
|
id |
Required |
String |
Unique ID of the feed |
|
type |
Required |
String |
"dimension" or "mainStructureMember" (also known as measure) as "type". The type defines what you can add to the according feed. |
|
description |
Optional |
String |
Description of the feed |
Simple Object Types
In addition to simple types (string, number, integer, boolean), script API data types, custom types and arrays of these types, you can also specify a simple object type using the form Object<type>.
This type represents a JavaScript object with keys of type string and values of type<type>. For example, the type Object<string> represents a JavaScript object with keys of type string and values of type string.
-
simple types (string, number, integer, boolean)
-
custom types
The following example shows how to use an object of type Object<number>, which represents a JavaScript object with keys of type string and values of type number: