Constructor
# new DefaultData(pluginConfiguration, props, eventopt)
Default constructor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pluginConfiguration |
DefaultConfiguration
|
Plugin configuration storage. | |
props |
object
|
All properties. | |
name |
string
|
Name of plugin. | |
version |
string
|
Version of plugin. | |
components |
Array.<Component>
|
<optional> |
Components array. |
variables |
Array.<Variable>
|
<optional> |
Variables array. |
definitions |
object
|
<optional> |
All definitions. |
definitions.components |
Array.<ComponentDefinition>
|
<optional> |
All component definitions. |
definitions.link |
Array.<ComponentLinkDefinition>
|
<optional> |
All component link definitions. |
parseLogs |
Array.<parseLog>
|
<optional> |
Parse log array. |
resources |
object
|
<optional> |
All svg models. |
resources.icons |
object
|
<optional> |
All svg models' icons |
resources.markers |
object
|
<optional> |
All svg models' markers. |
resources.links |
object
|
<optional> |
All svg models' links. |
resources.models |
object
|
<optional> |
All svg models' components. |
resources.style |
string
|
<optional> |
All specific style. |
scene |
object
|
<optional> |
All scene data, position, zoom factor, current selection and selected container type. |
scene.x |
number
|
<optional> |
Translation x of the scene. |
scene.y |
number
|
<optional> |
Translation y of the scene. |
scene.zoom |
number
|
<optional> |
Zoom factor of the scene. |
scene.selection |
Array.<string>
|
<optional> |
List of ids of selected components. |
scene.selectionRef |
string
|
<optional> |
Type on container selection. If null it refers to root container. |
event |
object
|
<optional> |
Event manager. |
next |
function
|
<optional> |
Function to emit event. |
Members
object
# scene
All scene data, position, zoom factor, current selection and selected container type.
Methods
# addComponent(definition, path) → {string}
Create and add new component inside components list.
Parameters:
Name | Type | Description |
---|---|---|
definition |
ComponentDefinition
|
Component definition. |
path |
string
|
Component path. |
Component id.
string
# canBeLinked(source, target) → {boolean}
Indicate if type can be linked with another.
Parameters:
Name | Type | Description |
---|---|---|
source |
string
|
Source type. |
target |
string
|
Target type. |
True if type can be linked to another otherwise false.
boolean
# canHaveLink(type) → {boolean}
Indicate if type can have a link.
Parameters:
Name | Type | Description |
---|---|---|
type |
string
|
Component type. |
True if component can have link otherwise false.
boolean
# createTemporaryLink(source, anchorName)
Create temporary link.
Parameters:
Name | Type | Description |
---|---|---|
source |
string
|
Id of component can be the source in a link. |
anchorName |
string
|
Anchor name of the component. |
# deleteAllEventLogsBefore(date)
Delete all event logs before the specified datetime.
Parameters:
Name | Type | Description |
---|---|---|
date |
number
|
Date time as timestamp. |
# emitEvent(props) → {number}
Emit event with log.
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
EventLog information. |
EventLog id.
number
# generateComponentId() → {string}
Generate id from definition and components list.
The id is composed of "id_" and the number of component plus 1.
Unique string for the id.
string
# getAttributeValue(attribute) → {string|Array.<string>}
Get the value of an attribute.
Parameters:
Name | Type | Description |
---|---|---|
attribute |
ComponentAttribute
|
Attribute to get value. |
Value of attribute.
string
|
Array.<string>
# getChildren(id) → {Array.<Component>}
Get children of container component with corresponding id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
Component container id. |
Children component array.
Array.<Component>
# getComponentByConfigurationKey(key) → {Component}
Get component by configuration any kind of key.
The configuration file is using a certain type of key for the components, this key is
used to define their position. So in order to retrieve the component's position from the
configuration file, we need to know which kind of key is used.
By default, if not overriden by plugin, it has the same behavior as getComponentById.
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
Key to use for finding the component. By default the key is the id. |
Component or null.
# getComponentById(id) → {Component}
Get component by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
Component id. |
Component or null.
# getComponentDepth(id) → {number}
Recursively calculates the depth of a component within a hierarchical structure, starting at 0.
The depth of a component is defined as the number of levels it is nested within other
components.
A top-level component has a depth of 0. For each level of nesting, the depth increases by 1.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
Component id. |
Component depth.
number
# getComponentIdFromValue(value) → {string}
Get the ID of a linked resource.
Parameters:
Name | Type | Description |
---|---|---|
value |
string
|
Value of the link. |
ID of the linked resource.
string
# getComponentsByType(type) → {Array.<Component>}
Get all components corresponding to the given type.
Parameters:
Name | Type | Description |
---|---|---|
type |
string
|
Type of component to find. |
Component list.
Array.<Component>
# getEventLogById(id) → {EventLog}
Get event log by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number
|
Event log id. |
Event log or undefined.
# getLinkedComponentsIds(attribute) → {Array.<string>}
Get the ID of the linked component.
Parameters:
Name | Type | Description |
---|---|---|
attribute |
ComponentAttribute
|
Link to get value. |
ID of the linked component.
Array.<string>
# getLinks() → {Array.<ComponentLink>}
Get all links from all component attributes.
List of links.
Array.<ComponentLink>
# getUsedLinkDefinitions() → {Array.<ComponentLinkDefinition>}
Uniquely get the definitions used for existing links.
- List of link definitions.
Array.<ComponentLinkDefinition>
# getVariableValue(name) → {string|Array.<string>}
Get the value of a variable.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
Name of the variable. |
Value of the variable.
string
|
Array.<string>
# getWorkflowLinks() → {Array.<ComponentLink>}
Build internal links for workflow containers.
List of links
Array.<ComponentLink>
# initLinkDefinitions(parentEventIdopt)
Initialize all link definitions from all component attribute definitions.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
parentEventId |
string
|
<optional> |
Parent event id. |
# insertComponentAfter(movedId, targetId)
Insert the moved component after the target in the internal component list
Parameters:
Name | Type | Description |
---|---|---|
movedId |
string
|
The id of the component to move |
targetId |
string
|
The id of the component that will be immediately before the moved component |
# insertComponentBefore(movedId, targetId)
Insert the moved component before the target in the internal component list
Parameters:
Name | Type | Description |
---|---|---|
movedId |
string
|
The id of the component to move |
targetId |
string
|
The id of the component that will be immediately after the moved component |
# removeComponentById(id)
Remove component by id and all attributes that used this component id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
Component id. |
# removeLink(link)
Remove link attribute in components.
Parameters:
Name | Type | Description |
---|---|---|
link |
ComponentLink
|
Link to remove. |
# renameComponentExternalId(id, newExternalId)
Rename a component external ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
ID of component. |
newExternalId |
string
|
New external ID of component. |
# setVariableValue(name, value)
Set the value of a variable.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
Name of the variable. |
value |
string
|
New value of the variable. |