API Reference
Namespaces
Classes
Events
Global
Externals

Class: MenuDropDown

WebComponents. MenuDropDown

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

<cq-menu-dropdown>

Menu DropDown handles holding the items that go inside a custom menu component.

Menu DropDown is a semantic element to be used in menus that has the same functionality as WebComponents.Scroll The main difference is that Menu DropDown sets noMaximize to true which means that the component will not automatically resize.

The preferred way of creating menus is to use the component. This component is supported for legacy purposes only.


Since:
  • 7.0.0 no longer dual inherits CIQ.UI.BaseComponent and CIQ.UI.Scroll. Now directly inherits Scroll which extends BaseComponent.

Example
<cq-menu class="ciq-menu ciq-studies collapse">
		 <span>Studies</span>
		 <cq-menu-dropdown cq-no-scroll>
			 <cq-study-legend cq-no-close>
				 <cq-section-dynamic>
					 <cq-heading>Current Studies</cq-heading>
					 <cq-study-legend-content>
						 <template>
							 <cq-item>
								 <cq-label class="click-to-edit"></cq-label>
								 <div class="ciq-icon ciq-close"></div>
							 </cq-item>
						 </template>
					 </cq-study-legend-content>
					 <cq-placeholder>
						 <div stxtap="Layout.clearStudies()" class="ciq-btn sm">Clear All</div>
					 </cq-placeholder>
				 </cq-section-dynamic>
			 </cq-study-legend>
			 <cq-scroll>
				 <cq-studies>
				 	 <cq-studies-content>
						<template>
							<cq-item>
								<cq-label></cq-label>
							</cq-item>
						</template>
					 </cq-studies-content>
				 </cq-studies>
			 </cq-scroll>
		 </cq-menu-dropdown>
	</cq-menu>

Extends

Methods


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:

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

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:

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:

deactivateItem(item)

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

Parameters:
Name Type Description
item HTMLElement
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
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:

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)

Overrides focusItem in CIQ.UI.BaseComponent.

Scrolls to an item and gives the item focus.

Parameters:
Name Type Description
item HTMLElement

The element to scroll to and focus. Must be a child of this component.

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

focused()

Returns the focused element or null. An item is focused if it has attribute cq-focused.

Inherited From:
Overrides:
Returns:

The element or null

Type
HTMLElement

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

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:

keyStroke(hub, key, e)

Handler for keyboard interaction.

Scroll components can handle up and down enter keystrokes. They do not register for claims directly. Another section of code must establish the claim on their behalf or proxy the keystroke.

Up and Down arrows will iterate through the scrollable elements. The attribute cq-focused will be added to the currently focused tag. This can then be queried later, such as when a user hits enter.

Left and Right arrows will iterate through the elements on the focused scrollable element, such as Remove and Edit buttons. Child elements must have the attribute keyboard-selectable-child set to "true" to be selectable with these keys.

Space bar or Enter will call the selectFC callback on the element if it exists.

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

Inherited From:
Overrides:
Returns:

true if keystroke was processed

Type
boolean

onKeyboardDeselection()

If we're using keyboard navigation, returns the highlight to the tab selected element.

Inherited From:
Overrides:

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>

refresh()

Refreshes the scrollbar, if CIQ.UI.scrollbarStyling is enabled.

Since:
  • 7.2.0

Inherited From:
Overrides:

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:

resize( [resizeFromNoHeight])

Resizes the componewnt when the screen is resized, or even if the configuraton is reloaded to add or remove items.

Parameters:
Name Type Argument Description
resizeFromNoHeight boolean <optional>

Optional flag to indicate whether the resize is triggered due to the component initially having no height. For example, true can be passed when resizing from the study legend component.

Since:
  • 9.8.0

Inherited From:
Overrides:

scrollToElement(item)

Scrolls to an element.

Parameters:
Name Type Description
item HTMLElement

The element to scroll to. Must be a child of this component.

Inherited From:
Overrides:

scrollToTop()

Scroll back to top (calls top()).

Inherited From:
Overrides:

top()

Scroll back to top

Inherited From:
Overrides:

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