Constructor
# new Component(propsopt)
Default constructor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
props |
object
|
<optional> |
Object that contains all properties to set. |
id |
string
|
<optional> |
The id of this Component. |
externalId |
string
|
<optional> |
The external id of this Component. |
name |
string
|
<optional> |
The name of this Component. |
definition |
ComponentDefinition
|
<optional> |
The Definition used to instantiate this Component. |
drawOption |
ComponentDrawOption
|
<optional> |
The options used to draw this Component. |
attributes |
Array.<ComponentAttribute>
|
<optional> |
Attributes of Component. |
Extends
Members
string
# externalId
The external id of this Component.
This external id is handled by the plugin itself and is not mandatory (defaulted to id).
# fileName
Get file name.
string
# id
The id of this Component.
The id is generated by the plugin-core for internal usage and should never be changed.
Methods
# canContain(type) → {boolean}
Indicate if component can contain provided component type.
Parameters:
Name | Type | Description |
---|---|---|
type |
string
|
Type of component. |
True if component can contain type otherwise false.
boolean
# createAttribute(props) → {ComponentAttribute}
Create a new instance of ComponentAttribute with the provided properties.
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
Properties to initialize the ComponentAttribute with. |
A new ComponentAttribute instance.
# getAttributeByName(name) → {ComponentAttribute|null}
Get attribute corresponding to the given name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
Name of attribute to find. |
Component attribute or null.
ComponentAttribute
|
null
# getAttributesByType(…types) → {Array.<ComponentAttribute>}
Get attributes corresponding to the given type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
types |
string
|
<repeatable> |
Type of attribute to find. |
Component attributes array.
Array.<ComponentAttribute>
# getConfigurationKey() → {string}
Get configuration key of the component.
By default, if not overriden by plugin, it will return the component's id.
Component's configuration key.
string
# getContainerId() → {string}
Retrieve container id from attributes.
Id of container or null.
string
# getDefinedAttributesByType(type) → {Array.<ComponentAttributeDefinition>}
Get defined attributes by type.
Parameters:
Name | Type | Description |
---|---|---|
type |
string
|
Type of attributes to get. |
- Defined attributes.
Array.<ComponentAttributeDefinition>
# getErrors(errorsopt) → {Array.<ParserLog>}
Set all errors of component.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. |
All component errors.
Array.<ParserLog>
# removeAllReferenceAttributes(container)
Remove all reference attributes, corresponding to the container if existing.
Parameters:
Name | Type | Description |
---|---|---|
container |
Component
|
Container. |
# removeLinkAttribute(id, nameopt)
Remove id in link attribute corresponding to the given name if provided
otherwise remove id in all link attributes' value.
Then if value is empty remove attribute.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
string
|
Id to remove. | ||
name |
string
|
<optional> |
null | Name of attribute to remove. |
# setExternalId(value)
Set the external id of this Component with value parameter.
Parameters:
Name | Type | Description |
---|---|---|
value |
string
|
New external id value. |
# setLinkAttribute(link)
Set the attribute of a given link.
Parameters:
Name | Type | Description |
---|---|---|
link |
ComponentLink
|
The link we want to set the attribute. |
# setReferenceAttribute(container)
Set container value in attributes.
Parameters:
Name | Type | Description |
---|---|---|
container |
Component
|
Container. |
# validateDefinition(errorsopt) → {Array.<ParserLog>}
Set error if definition is null.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. |
All component errors.
Array.<ParserLog>