Constructor
# new ComponentAttribute(propsopt)
Default constructor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
props |
object
|
<optional> |
Object that contains all properties to set. |
name |
string
|
<optional> |
The name of the attribute. |
value |
string
|
boolean
|
number
|
Array
|
Array.<ComponentAttribute>
|
<optional> |
The value of the attribute. |
type |
string
|
<optional> |
The real type of the attribute, valid types are String/Boolean/Number/Array/Object. |
definition |
ComponentAttributeDefinition
|
<optional> |
The definition of the attribute. |
Members
# isVariable
Check if the attribute is a variable.
string
# type
The type of the attribute, real type of the attribute, to check if it matches with the
ComponentAttributeDefinition.
Methods
# getErrors(errorsopt, recurseopt, idopt) → {Array.<ParserLog>}
Get all errors of the attribute.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. | |
recurse |
boolean
|
<optional> |
false | If true, get sub-attributes errors recursively. |
id |
string
|
<optional> |
null | Component id. |
All attributes error.
Array.<ParserLog>
# validateDefinitionType(errorsopt, idopt) → {Array.<ParserLog>}
Set if definition type is according to type.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. | |
id |
string
|
<optional> |
null | Component id. |
All attributes error.
Array.<ParserLog>
# validateRequiredAttributes(errorsopt, idopt) → {Array.<ParserLog>}
Set error if the required attribute is not present or if its value is null.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. | |
id |
string
|
<optional> |
null | Component id. |
All attributes error.
Array.<ParserLog>
# validateRuleMinMax(errorsopt, idopt) → {Array.<ParserLog>}
Set error if :
- Value is a string or array and its length is less than the specify minimum length.
- Value is a string or array and its length is greater than the specify maximum length.
- Value is a number and its value is less than the specify minimum value.
- Value is a number and its value is greater than the specify maximum value.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. | |
id |
string
|
<optional> |
null | Component id. |
All attributes error.
Array.<ParserLog>
# validateRuleRegex(errorsopt, idopt) → {Array.<ParserLog>}
Set error if value is not null and not match the specify regex.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. | |
id |
string
|
<optional> |
null | Component id. |
All attributes error.
Array.<ParserLog>
# validateRuleValues(errorsopt, idopt) → {Array.<ParserLog>}
Set error if value or all elements of value array is not included in the specify values.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
errors |
Array.<ParserLog>
|
<optional> |
Errors to set, can be null. | |
id |
string
|
<optional> |
null | Component id. |
All attributes error.
Array.<ParserLog>