Classes
Quick reference
Members
- (static, constant) SUPPORTS_LOCAL_STORAGE :boolean
- (static, constant) touchable :object
Getters
- (static) getTreeItemById(id, tree) → {object}
- (static) getTreeParentById(id, tree, parentIdopt) → {string|int}
Methods
- (static) addClass(el, className)
- (static) buildOrderedParentPairs(treeopt) → {Array.<object>}
- (static) flatArrayEqual()
- (static) injectStyle(id, style) → {DOMElement|boolean}
- (static) parents()
- (static) removeClass(el, className)
- (static) resizeOpposite(containerId, oppositeId, width)
- (static) updateTreeItemById(id, tree, callback, setState)
- (static) uuid() → {string}
Members
(static, constant) SUPPORTS_LOCAL_STORAGE :boolean
If true the current browser supports local storage.
Type:
- boolean
(static, constant) touchable :object
An object with the touchable event names for mouseup, mousedown, mousemove.
Type:
- object
Methods
(static) addClass(el, className)
Helper function to add a class to a DOMElement.
Parameters:
Name | Type | Description |
---|---|---|
el |
DOMElement | The element |
className |
string | The class names |
(static) buildOrderedParentPairs(treeopt) → {Array.<object>}
Builds an ordered parent pairs array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tree |
Array.<object> |
<optional> |
[] | The tree |
Returns:
With fid (node id) and the given pid (parent id)
- Type
- Array.<object>
(static) flatArrayEqual()
Checks if two flat arrays are equal.
(static) getTreeItemById(id, tree) → {object}
Get the tree node by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | int | The id |
tree |
Array.<object> | TreeNode properties |
Returns:
- Type
- object
(static) getTreeParentById(id, tree, parentIdopt) → {string|int}
Get the parent id of a tree node.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
string | int | The id which you want to fetch the parent of | ||
tree |
Array.<object> | TreeNode properties | ||
parentId |
string | int |
<optional> |
0 | If the item has no parent this id is returned |
Returns:
Can also return undefined if not found
- Type
- string | int
(static) injectStyle(id, style) → {DOMElement|boolean}
Allows to inject a virtual CSS style sheet.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The unique id for the style. If already available it gets overriden by the new style rules |
style |
string | The style rules |
Returns:
If successful it returns the script-DOMElement and false if failure
- Type
- DOMElement | boolean
(static) parents()
Get parent of a element.
- Source:
- See:
(static) removeClass(el, className)
Helper function to remove a class to a DOMElement.
Parameters:
Name | Type | Description |
---|---|---|
el |
DOMElement | The element |
className |
string | The class names |
(static) resizeOpposite(containerId, oppositeId, width)
Resizes a given container with calc(100% - width).
Parameters:
Name | Type | Description |
---|---|---|
containerId |
string | The container ID |
oppositeId |
string | The opposite ID of container |
width |
int | Width in px |
(static) updateTreeItemById(id, tree, callback, setState)
Allows to update a tree node item by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | id | The id of the tree node |
tree |
Array.<object> | The TreeNode properties to modify |
callback |
module:react-aiot/util#updateTreeItemByIdCallback | |
setState |
module:react-aiot/util#updateTreeItemByIdSetState |
(static) uuid() → {string}
Create a unique id.
Returns:
- Type
- string
Type Definitions
updateTreeItemByIdCallback(node)
This function is called when the tree node is found in updateTreeItemById.
You can then modify the node.
Parameters:
Name | Type | Description |
---|---|---|
node |
object | TreeNode |
updateTreeItemByIdSetState(tree)
This function is called when the tree node is successfully modified by your
callback and can no be setted as state in your component.
Parameters:
Name | Type | Description |
---|---|---|
tree |
Array.<object> | The new TreeNode properties |