Class: QueryItem

QueryItem

This class holds query and contains InputItemWrappers and their InputItems and OptionItems for draggable queries.

Constructor

new QueryItem(queryData)

Create QueryItem.
Parameters:
Name Type Description
queryData QueryDataBlock A QueryDataBlock instance holding all relevant query data.
Source:

Members

draggable

Sets draggable plugin for this QueryItem.
Source:

draggable

Get pre-set draggable plugin or default if none set.
Source:

value

Get all nested inputItems values.
Source:

Methods

checkIfOptionItemIsInsideInput(optionItem, optionalMarginopt) → {InputItems|false}

Check if OptionItem it is in any of the InputItems of this QueryItem.
Parameters:
Name Type Attributes Description
optionItem OptionItem An OptionItem which position should be found.
optionalMargin number <optional>
Margin to be taken taken in account while matching OptionItem's position on InputItem positions.
Source:
Returns:
- Return matched InputItem instance or false if none found.
Type
InputItems | false

createInput() → {QueryItem}

Creates InputItemWrapper and assigns it to the internal list of such items.
Source:
Returns:
- Returns instance of this QueryItem.
Type
QueryItem

makeOptionDraggable(optionItem) → {QueryItem}

Makes passed OptionItem graggable. Requires interact.js module!
Parameters:
Name Type Description
optionItem OptionItem Use the passed optionItem to make it draggable.
Source:
Returns:
- Returns instance of this QueryItem.
Type
QueryItem

optionItemResetPageResizeListener(optionItem, callback) → {QueryItem}

Resets OptionItem if moved out of assigned input item upon window size chage.
Parameters:
Name Type Description
optionItem OptionItem Use the passed optionItem to add an action to upon event listener call.
callback function Potential callback function.
Source:
Returns:
- Returns instance of this QueryItem.
Type
QueryItem

renderOptions() → {dom|false}

Generates dragable items. Requires options to be set in QueryItem.queryData.
Source:
Returns:
- A newly created optionsContainer dom element, wrapping each OptionItem or false if no options present for this QueryItem.
Type
dom | false

validate() → {Object}

Propagate validation to the nested inputItems and return Object.
Source:
Returns:
- Object containing an array of each InputItem and a boolean that is true if this query is valid: { allAvalid: bool, inputItems: InputItem[] }.
Type
Object

write(container) → {QueryItem}

Writes the content of this QueryItem to a specified DOM container.
Parameters:
Name Type Description
container dom Use the passed dom element to contain this QueryItem.
Source:
Returns:
- Returns instance of this QueryItem.
Type
QueryItem