API Reference
Namespaces
Modules
Classes
Events
Global
Externals

Class: LookupDialog

WebComponents. LookupDialog ()

This is a custom HtmlElement (Web Component). The tag name is the following:

<cq-lookup-dialog>

This dialog allows the search and selection of securities to load on the chart. It supports both primary and secondary series (comparison) selection.

Attributes

This component observes the following attributes and will change behavior if these attributes are modified:

attribute description
filter Security type filter for search results.

In addition, the following attributes are also supported. These may be set on either this element itself, or on the calling element which invokes this element. If set on both, the caller's setting takes priority:

attribute description
comparison Indicates that the dialog is for secondary series (comparisons).
cq-maintain-case When set to truthy value, maintains case of entered symbol. Otherwise, symbol is capitalized before processing.

Emitters

A custom event will be emitted by the component whenever the search input is changed. See CIQ.UI.BaseComponent#emitCustomEvent for details on how to listen for this event. The details of the event contain the following:

property value
emitter this component
cause "useraction"
effect "search"
action "input"
value search string

A custom event will be emitted by the component whenever the search string is activated (the symbol is loaded). See CIQ.UI.BaseComponent#emitCustomEvent for details on how to listen for this event. The details of the event contain the following:

property value
emitter this component
cause "useraction"
effect "select"
action "click"
symbol symbol
name symbol description
exchDisp symbol exchange

This component comes with a default markup which is used when the component tag contains no other markup when it is added to the DOM. The default markup provided has accessibility features.


<protected> new LookupDialog()

Since:
  • 8.8.0
  • 9.1.0 Added emitter.
Example

Set cq-maintain-case to true to prevent capitalization

stxx.uiContext.config.dialogs.lookup.attributes["cq-maintain-case"] = true;

Extends

Members


context :CIQ.UI.Context

Context

Type:
Inherited From:
Overrides:

<static> markup :string

Default markup for the component's innerHTML, to be used when the component is added to the DOM without any innerHTML.

Type:
  • string

<static> symbolOperations :Record.<string, WebComponents.LookupDialog~SymbolOperation>

Symbol operation metadata used by the equation builder.

Type:

<static> verticalStructure :Array.<string>

Defines order of subsections within the component.

Type:
  • Array.<string>

Methods


acceptText(value)

Handles accepted text by the input and sends text to Lookup Driver. Passes results to WebComponents.LookupDialog#results.

Parameters:
Name Type Description
value string

Input text


addClaim()

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

Inherited From:
Overrides:

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

Inherited From:
Overrides:

addSymbolOperationListeners()

Adds operation item listeners after cq-menu renders its dropdown content.

Since:
  • 10.6.0


<protected> adoptedCallback()

Inherited From:
Overrides:

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

Inherited From:
Overrides:

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

Inherited From:
Overrides:
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

Inherited From:
Overrides:
Returns:

A callback invoked when unsubscribing from the channel.

Type
function | undefined

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

Inherited From:
Overrides:

chooseResult(data)

Handles a selected autocomplete result.

Parameters:
Name Type Description
data object

Result data

Since:
  • 10.6.0


clickFocusedItem(items, e)

Selects (clicks) the first element in items that has a cq-focused attribute.

Parameters:
Name Type Description
items NodeList

A list of elements that are selectable via keyboard navigation.

e Event

The keystroke event.

Since:
  • 8.3.0

Inherited From:
Overrides:

close()

Closes the dialog and resets the input.

Overrides:

deactivateItem(item)

Blurs and removes the cq-keyboard-active attribute from item.

Parameters:
Name Type Description
item HTMLElement

The HTML element to deactivate

Since:
  • 8.4.0

Inherited From:
Overrides:

emitCustomEvent(params)

Emits a custom event from the webcomponent. The event type of the emitted event is determined by the particular user action taken. Up to two events are emitted when this function is executed. The first is an event with the type of action performed, if there is one. For example, events which are spawned without user action will not emit this first event. The second event will have a type derived from the component name. For example, the cq-study-legend component will emit a "StudyLegend" type event. The payload of the event will contain a detail section specifying the component which emitted the event as well as the effect - which more clearly defines the type of action causing the emittance. The detail section may also include custom fields further categorizing the event and providing additional information. These details are documented within the web component's documentation.

Parameters:
Name Type Description
params object

Configuration parameters.

Properties
Name Type Argument Default Description
cause string <optional>

The cause of the event. e.g., useraction, timeout, alert. Defaults to "useraction" if not set and action parameter is set.

effect string <optional>

The effect of the user's action. Required if not provided in detail. e.g., open, help, toggle, select.

action string | null <optional>
"click"

The action a user performed, if applicable. e.g. click, longpress, drag. Set to null if no user action was performed.

detail object <optional>
{}

Optional extra parameters to include in the detail of the Custom Event.

Since:
  • 8.9.0
  • 9.1.0 Changed params object's property names.
Inherited From:
Overrides:
Example

Listening for a custom event using the standard addEventListener method.

document.addEventListener("DrawingPalette", (e) => {
	console.log(`Drawing Palette "view" is now: ${e.detail.view}`)
})

// For a given component tag we can find name of the event to listen using:

const componentEventName = CIQ.UI.components("cq-drawing-palette")[0].name;

// If the document might have multiple chart context elements (cq-context), add the listener to the specific context element instead of the document itself.

findFocused(items)

Finds the elements in items that have a cq-focused attribute.

Parameters:
Name Type Description
items NodeList

A list of elements that are selectable via keyboard navigation.

Since:
  • 8.3.0

Inherited From:
Overrides:
Returns:

The elements in items that have a cq-focused attribute, or an empty array if no elements are found.

Type
Array

findKeyboardActive(items)

Finds the elements in items that have a cq-keyboard-active attribute.

Parameters:
Name Type Description
items NodeList

A list of elements that are selectable via keyboard navigation

Since:
  • 8.4.0

Inherited From:
Overrides:
Returns:

The elements in items that have a cq-keyboard-active attribute, or an empty array if no elements are found.

Type
Array

focusItem(item)

Adds a cq-focused attribute to item and highlights item.

Parameters:
Name Type Description
item HTMLElement

Element that receives keyboard focus and is highlighted.

Since:
  • 8.3.0

Inherited From:
Overrides:

focusNextItem(items [, reverse] [, loop])

Focuses the next item in the tab order.

Locates the first element in items that has a cq-focused attribute. If an element is found, the attribute is removed from all elements in items, and cq-focused is applied to the element that follows (in the tab order) the element that was found.

If no elements are found with the cq-focused attribute, the attribute is applied to the first element in items (last element if reverse is true). If the last element in items (first element if reverse is true) is found to have the cq-focused attribute, focus remains on that element. Unless loop is set to true, then focus is applied to first element.

Parameters:
Name Type Argument Description
items NodeList

A list of elements that are selectable via keyboard navigation.

reverse boolean <optional>

If true, the operation is performed in reverse order; that is, from the last element in items to the first.

loop boolean <optional>

Loops back to the first item if the last element in items is selected.

Since:
  • 8.4.0 Added loop parameter. Return element, instead of true, if focus is changed.

Inherited From:
Overrides:
See:
Returns:

The newly focused element if a cq-focused attribute has changed.

Type
HTMLElement | undefined

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

Inherited From:
Overrides:
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

Inherited From:
Overrides:
Returns:

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

Type
HTMLElement | undefined

getRequiredSymbolInputs()

Gets the symbol inputs required by the current symbol operation.

Since:
  • 10.6.0

Returns:

Required symbol inputs.

Type
Array.<HTMLInputElement>

getSymbolOperation()

Gets metadata for the selected symbol operation.

Since:
  • 10.6.0

Returns:

Symbol operation metadata

Type
WebComponents.LookupDialog~SymbolOperation

getSymbolValue()

Gets the symbol string represented by the current symbol entry mode.

Since:
  • 10.6.0

Returns:

Symbol or equation string

Type
string

handlePropertyChange(name, oldValue, newValue)

Processes attribute changes. This is called whenever an observed attribute has changed.

Parameters:
Name Type Description
name string

Attribute name

oldValue string

Original attribute value

newValue string

new Attribute value


handleSymbolOperationMenuKey(e)

Handles keyboard interaction while focus is on the symbol operation menu.

Parameters:
Name Type Description
e KeyboardEvent

Keyboard event to handle.

Since:
  • 10.6.0

Returns:

true when the key was handled.

Type
boolean

hide()

Hides the dialog. This performs UI cleanup of the color picker.

Since:
  • 10.6.0 Resets the symbol operation on every dialog dismissal path.


initialize()

Initializes the component the first time it has been opened. Sets all the default markup and adds listeners.


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.

Inherited From:
Overrides:

isEquationBuilderActive()

Returns whether the lookup is in equation builder mode.

Since:
  • 10.6.0

Returns:

true when an equation operation is selected

Type
boolean

isEquationBuilderAvailable()

Returns whether equation charts are supported by the loaded library modules. The equation builder requires CIQ.formatEquation and CIQ.fetchEquationChart, which are provided by the equations advanced module.

Since:
  • 10.6.0

Returns:

true when the equation builder can be offered

Type
boolean

keyStroke(hub, key, e)

Handle the keystroke event to keyboard navigate the dialog. Arrow keys and Enter are supported.

Parameters:
Name Type Description
hub CIQ.UI.KeystrokeHub

The hub that processed the key

key string

Key that was stroked

e Event

The event object

Returns:

true if keystroke was processed

Type
boolean

<protected> makeTap(node, cb)

Attaches an "stxtap" event to an element, which will be fired on any event that resembles a click or tap. Note only one stxtap event is allowed per element. The handler is saved on the element as the selectFC property.

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 Description
node HTMLElement

The element to attach a tap event to.

cb CIQ.UI.BaseComponent~makeTapCallback

The callback when tapped.

Inherited From:
Overrides:

naturalTabElements(element)

Returns all elements that are navigable by a browser's default tabbing algorithm

Parameters:
Name Type Description
element HTMLElement

Element to query selectors from.

Since:
  • 8.8.0

Inherited From:
Overrides:
Returns:

Array containing all tab navigable elements.

Type
Array.<HTMLElement>

open(params)

Opens the dialog tag and displays it over the chart. Works with the dialog channel.

Parameters:
Name Type Description
params object

Dialog box parameters.

Properties
Name Type Argument Description
context CIQ.UI.Context

The chart user interface context.

caller HTMLElement <optional>

caller element that triggered the opening.

callback function <optional>

callback called when an item is selected.

useFirstResult boolean <optional>

whether to return the first result when hitting enter.

Since:
  • 9.0.0 respect caller element cq-maintain-case for symbols added from input box.
  • 9.5.0 added useFirstResult
  • 10.6.0 Supports symbol operations for comparisons. Hides the symbol operation menu when equation charts are unavailable.
Overrides:

openSymbolOperationMenuFromKeyboard(e)

Opens the symbol operation menu from keyboard interaction.

Parameters:
Name Type Description
e KeyboardEvent

Keyboard event that opened the menu.

Since:
  • 10.6.0


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

Inherited From:
Overrides:
Returns:

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

Type
HTMLElement | undefined

qsa(path, root, bustShadowRoots)

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 to find.

root HTMLElement | string

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

bustShadowRoots boolean

Set to true to penetrate shadow root boundaries.

Since:
  • 7.5.0
  • 8.9.0 Added bustShadowRoots parameter
Inherited From:
Overrides:
Returns:

An array of selected DOM element.

Type
Array.<HTMLElement>

removeClaim()

Remove a claim on keystrokes.

Inherited From:
Overrides:

removeFocused(items)

Removes the cq-focused attribute from all elements in items.

Parameters:
Name Type Description
items NodeList

A list of elements that are selectable via keyboard navigation.

Since:
  • 8.3.0

Inherited From:
Overrides:

reset()

Resets the dialog back to its default state with no search results


results(resultsArr)

Processes the results returned from the CIQ.ChartEngine.Driver.Lookup

Parameters:
Name Type Description
resultsArr Array.<object>

Search results returned by the lookup driver.


selectItem(value)

Function that triggers when an item is selected from either the input or results list.

Parameters:
Name Type Description
value string | object

Either the value of the item selected or a symbolObject containing the symbol.

Since:
  • 8.8.0 value param accepts a string or symbolObject.


setContext(context)

Called for a registered component when the context is constructed. Sets the context property of the component.

Parameters:
Name Type Description
context CIQ.UI.Context

The chart user interface context.

Overrides:

setDriver(driver)

Connects a CIQ.ChartEngine.Driver.Lookup to the web component.

The lookup driver searches financial exchanges for symbols that match the text entered in the component's input field.

Parameters:
Name Type Description
driver CIQ.ChartEngine.Driver.Lookup

The lookup driver to connect to the web component.


setFilter(e)

Sets a selected filter as the active filter that is applied to WebComponents.LookupDialog#acceptText

Parameters:
Name Type Description
e PointerEvent

Emitted pointer event


setSymbolInputError(input, hasError)

Sets or clears the error state on a symbol input.

Parameters:
Name Type Description
input HTMLInputElement

Symbol input to update.

hasError boolean

Whether the input is in error state.

Since:
  • 10.6.0


setSymbolOperation( [operation] [, focusSymbolInput])

Updates the lookup input layout for the selected symbol operation. When the equation builder is unavailable, the operation is forced to "single" and the symbol operation menu is hidden.

Parameters:
Name Type Argument Default Description
operation string <optional>

Symbol operation to select.

focusSymbolInput boolean <optional>
false

Set to true to focus the next symbol input.

Since:
  • 10.6.0 Forces single security mode when equation charts are unavailable.

trimInnerHTMLWhitespace()

Returns a copy of the innerHTML of an element, with leading and trailing characters stripped. The following characters are stripped: newline, carriage return, tab.

Since:
  • 9.1.0

Inherited From:
Overrides:
Returns:

Trimmed innerHTML

Type
string

updateFilters()

Updates filters based on values in dialog's cq-lookup-filters attribute

Since:
  • 10.1.0


validateSymbolInputs()

Validates required symbol inputs for the current symbol operation.

Since:
  • 10.6.0

Returns:

true when all required symbol inputs have values.

Type
boolean

Type Definitions


SymbolOperation

Type:
  • object
Properties:
Name Type Description
operator string

Operator used in the equation.

displayOperator string

Operator displayed in the equation builder.

label string

Display name of the operation.