Class: BaseComponent

CIQ.UI. BaseComponent


new BaseComponent()

Abstract class for WebComponents using this framework.

Provides a base set of functionality for web components.

See:

Extends

  • HTMLElement

Methods


<static> bind()

Set bindings for a node that has been created dynamically. The attribute can be either "stxbind", "stxtap" or "stxsetget".

Deprecated:
  • Yes
See:

<static> bindNode(node [, params])

Set bindings for a node that has been created dynamically. The attribute can be either "stxbind", "stxtap" or "stxsetget".

Designed to be used as a helper method for the included WebComponents. A full tutorial on how to work with and customize the WebComponents can be found here: Web Component Interface.

In the case of stxsetget, a "set" and "get" will be prepended to the bound method. .getXxxxx() will be called once during this initialization. That method should set up a binding.

When tapping (or changing value in the case of an input field) .setXxxx() will be called.

Bindings in web components will search for the nearest parent component that contains the expected function (see the examples).

Parameters:
Name Type Argument Description
node HTMLElement

The node to bind.

params Object <optional>

Parameters passed as the final argument.

Since:
Examples

Look for the next parent with method tool().

stxtap = "tool('gartley')";

To explicitly target a web component, use a prefix.

stxtap = "DrawingToolbar.tool('gartley')";

<static> buildReverseBindings( [traverseNode])

Travels the DOM tree and locates stxbind attributes.

Designed to be used as a helper method for the included WebComponents. A full tutorial on how to work with and customize the web components can be found here: Web Component Interface.

UI elements can use these to configure menus or dialogs. To effect reverse binding, set the value of the stxbind attribute to a Helper class name and data element. For instance Layout.chartStyle.

The Helper element will seek out all children with stxtap attribution and examine the arguments to that function call for a match.

Parameters:
Name Type Argument Description
traverseNode HTMLElement <optional>

Specify the node to traverse. Defaults to topNode for the context.


<static> getChannel(path [, stx] [, self])

Retrieves a channel object and property from the given path.

Parameters:
Name Type Argument Description
path *

The channel path.

stx CIQ.ChartEngine <optional>

A reference to the chart engine.

self Object <optional>

A component reference used to optionally obtain a reference to the chart engine.

Since:
  • 7.5.0

Returns:

An object containing the channel object and property name. Returns undefined if the path is not provided or if one of stx or self is not provided.

Type
Object | undefined

<static> getHelper(node [, binding], attribute)

Locates the nearest UI helper for a given attribute. If none exists, then it is created at the top node of the chart context.

Designed to be used as a helper method for the included WebComponents. A full tutorial on how to work with and customize the WebComponents can be found here: Web Component Interface.

Parameters:
Name Type Argument Description
node HTMLElement

A node with either the stxbind or stxtap attribute.

binding String <optional>

The type of binding or helper name being looked for, otherwise the stxbind and then stxtap attributes are queried

attribute String

Either "stxtap" or "stxbind". Only required if binding==null.

Returns:

A UI helper object.

Type
CIQ.UI.Helper

<static> selfOrParentElement(startEl, classOrAttributeOrTag)

Searches the DOM for an element that has the CSS class, HTML attribute, or tag name (node name) specified in classOrAttributeOrTag.

Begins the search with startEl and proceeds up the ancestry tree until an element is found or the root of the tree has been reached.

Parameters:
Name Type Description
startEl HTMLElement

The element on which to start the search.

classOrAttributeOrTag String

The CSS class, HTML attribute, or node name for which to search.

Since:
  • 7.5.0

Returns:

The found element or undefined if an element was not found.

Type
HTMLElement | undefined

<static> toPropAndObject(path, startObj)

Walks an object path by means of the elements of the path argument, excluding the last element. Starts the walk with startObj.

For example, if the path is "x.y.z.end" and the starting object is myObj, the function attempts to find myObj.x.y.z.

Parameters:
Name Type Description
path String

A string of dot-separated elements, such as "channel.breakpoint".

startObj Object

The initial object in the object path, such as an instance of CIQ.ChartEngine.

Since:
  • 7.5.0

Returns:

An object literal containing the last property in the path and an object referenced by the succession of the preceding path elements; for example, the path channel.breakpoint and an instance of the chart engine as the starting object would produce {"breakpoint", chartEngine.channel}. If any of the path elements (excluding the last) is not a property of the object path, the function returns an empty object ({}).

Type
Object

addClaim(helper)

Claim any keystrokes that come in. Once claimed, any keystrokes that come in are passed to the helper. The helper can then choose to capture or propagate the keystrokes. This enables a helper to capture keystrokes even if it doesn't have mouse focus.

Parameters:
Name Type Description
helper HTMLElement

The element that should claim a keystroke.


addDefaultMarkup(component [, markup])

Adds default markup to a web component if the component does not have any child nodes.

Parameters:
Name Type Argument Description
component HTMLElement

The component to which the markup is added.

markup String <optional>

The markup to add to the web component. Unused if the component has a static markup property that specifies the markup; for example, MyComponent.markup.

Since:
  • 7.5.0


channelMergeObject(path, value, stx)

Merges an object in the chart engine communication channel.

Parameters:
Name Type Description
path String

The channel path.

value Object

The value merged to the channel.

stx CIQ.ChartEngine

A reference to the chart engine.

Since:
  • 7.5.0


channelRead(path [, stx])

Reads the current value in the chart engine communication channel.

Parameters:
Name Type Argument Description
path String

The channel path.

stx CIQ.ChartEngine <optional>

Unused.

Since:
  • 7.5.0

Returns:

The current value in channel.

Type
*

channelSubscribe(path, cb, stx)

Subscribes to the chart engine messaging channel.

Parameters:
Name Type Description
path *

The channel path.

cb *

A callback invoked upon subscribing and whenever a new message is posted in the channel.

stx CIQ.ChartEngine

A reference to the chart engine.

Since:
  • 7.5.0

Returns:

A callback invoked when unsubscribing from the channel.

Type
function

channelWrite(path, value, stx)

Writes in the chart engine communication channel.

Parameters:
Name Type Description
path String

The channel path.

value *

The value written to the channel.

stx CIQ.ChartEngine

A reference to the chart engine.

Since:
  • 7.5.0


getChartContainer( [el])

Searches the DOM for the chart container element. Begins the search with el (or this) and proceeds parent-by-parent up the ancestry tree until an element is found.

Parameters:
Name Type Argument Description
el HTMLElement <optional>

The element on which to start the search. If not provided, this is used.

Since:
  • 7.5.0

Returns:

The chart container element or undefined if an element is not found.

Type
HTMLElement | undefined

getContextContainer( [el])

Searches the DOM for the chart context element. Begins the search with el (or this if el is not provided) and proceeds up the ancestry tree until an element is found or the root of the tree has been reached.

Parameters:
Name Type Argument Description
el HTMLElement <optional>

The element on which to start the search. If not provided, this is used.

Since:
  • 7.5.0

Returns:

The chart context element or undefined if an element is not found.

Type
HTMLElement | undefined

inputEntry(node, cb)

Attaches a keyboard input entry event.

Parameters:
Name Type Description
node HTMLElement

The element to which the input entry event is attached.

cb function

The callback function invoked when input entry occurs.


qs(path, context)

Adapts the querySelector method.

Parameters:
Name Type Description
path String

The CSS selectors for which to search.

context HTMLElement | String

The chart context element, which is the starting point of the DOM query, or "thisChart" to indicate the chart context in which this function is called.

Since:
  • 7.5.0

Returns:

The selected DOM element or undefined if an element is not found.

Type
HTMLElement | undefined

qsa(path, context)

Adapts the querySelectorAll method. Returns an array instead of a node list to enable chaining of the array map, filter, forEach, and reduce functions.

Parameters:
Name Type Description
path String

The CSS selectors for which to search.

context HTMLElement | String

The chart context element, which is the starting point of the DOM query, or "thisChart" to indicate the chart context in whidh this function is called.

Since:
  • 7.5.0

Returns:

An array of selected DOM element or undefined if no elements are found.

Type
HTMLElement | undefined

removeClaim(helper)

Remove a claim on keystrokes.

Parameters:
Name Type Description
helper CIQ.UI.Helper

Helper or ContextTag from which the claim on keystrokes is removed.