Module: react-aiot/util

Classes

Storage

Quick reference

Members

(static, constant) SUPPORTS_LOCAL_STORAGE :boolean

If true the current browser supports local storage.
Type:
  • boolean
Source:

(static, constant) touchable :object

An object with the touchable event names for mouseup, mousedown, mousemove.
Type:
  • object
Source:

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
Source:

(static) buildOrderedParentPairs(treeopt) → {Array.<object>}

Builds an ordered parent pairs array.
Parameters:
Name Type Attributes Default Description
tree Array.<object> <optional>
[] The tree
Source:
Returns:
With fid (node id) and the given pid (parent id)
Type
Array.<object>

(static) flatArrayEqual()

Checks if two flat arrays are equal.
Source:

(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
Source:
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
Source:
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
Source:
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
Source:

(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
Source:

(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
Source:

(static) uuid() → {string}

Create a unique id.
Source:
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
Source:

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
Source: