Class: Utils

Kekule.Widget. Utils

new Utils()

Helper methods about widget.
Source:

Methods

(static) createFromHash(parentOrElementOrDocument, defineObj) → {Kekule.Widget.BaseWidget}

Create widget from a definition hash object. The hash object may include the following fields: { 'widgetClass' or 'widget': widget class, class object or string, must have, 'htmlClass': string, HTML class name should be added to widget, 'children': array of child widget definition hash } Other fields will be set to properties of widget with the same names. If the field name starts with '#' and the value is a function, then the function will be set as an event handler.
Parameters:
Name Type Description
parentOrElementOrDocument Variant
defineObj Hash
Source:
Returns:
Type
Kekule.Widget.BaseWidget

(static) getBelongedResponsiveWidget(element) → {Kekule.Widget.BaseWidget}

Returns widget the element belonged to. The widget must be a non-static one.
Parameters:
Name Type Description
element HTMLElement
Source:
Returns:
Type
Kekule.Widget.BaseWidget

(static) getBelongedWidget(element) → {Kekule.Widget.BaseWidget}

Returns widget the element belonged to.
Parameters:
Name Type Description
element HTMLElement
Source:
Returns:
Type
Kekule.Widget.BaseWidget

(static) getWidgetById(id, doc) → {Kekule.Widget.BaseWidget}

Returns an ID specified widget in document.
Parameters:
Name Type Description
id String
doc HTMLDocument
Source:
Returns:
Type
Kekule.Widget.BaseWidget

(static) getWidgetOnElem(element) → {Kekule.Widget.BaseWidget}

Returns widget binding on element.
Parameters:
Name Type Description
element HTMLElement
Source:
Returns:
Type
Kekule.Widget.BaseWidget

(static) getWidgetsInsideElem(element, checkElemInsideWidget) → {Array}

Returns all widgets in element and its child elements.
Parameters:
Name Type Description
element HTMLElement
checkElemInsideWidget Bool
Source:
Returns:
Type
Array

(static) setWidgetPropFromElemAttrib(widget, attribName, attribValue)

When binding to element, properties of widget can be set by element attribute values. This method helps to turn string type attribute values to proper type and set it to widget.
Parameters:
Name Type Description
widget Kekule.Widget.BaseWidget
attribName String
attribValue String
Source: