Module: searchmenu

Contains the main ui component of the search menu ui.

Source:

Classes

SearchMenuAPI
SearchMenuUI
SearchViewDescriptionBuilder

Type Definitions

DataConverter(searchData) → {module:searchmenu.SearchUiData}

This function converts the data from search backend to the structure needed by the search UI.

Parameters:
Name Type Description
searchData Object
Source:
Returns:

converted and structured data for search UI

Type
module:searchmenu.SearchUiData

ElementCreatedListener(newlyCreatedElement, isParent)

This function will be called when a new HTML is created.

Parameters:
Name Type Description
newlyCreatedElement Element
isParent boolean

true, if it is the created parent. false, if it is a child within the created parent.

Source:

ElementFoundListener(foundElement, isParent)

This function will be called for every found element

Parameters:
Name Type Description
foundElement Element
isParent boolean

true, if it is the created parent. false, if it is a child within the created parent.

Source:

ElementPredicate(element) → {boolean}

Parameters:
Name Type Description
element Element
Source:
Returns:

true, when the predicate matches the given element, false otherwise.

Type
boolean

FieldsJson() → {String}

Source:
Returns:

JSON of all contained fields

Type
String

ListElementFunction(listElement) → {Object}

This function is called for every html element of a given parent.

Parameters:
Name Type Description
listElement Element

name of the sub menu entries

Source:
Returns:

optional result to exit the loop or null otherwise.

Type
Object

ListElementIdProperties

Type:
  • Object
Properties:
Name Type Description
id id

Original ID

type string

Type of the list element

index number

Index of the list element

previousId string

ID of the previous list element

nextId string

ID of the next list element

firstId string

ID of the first list element

lastId string

ID of the last list element

subMenuId module:searchmenu.SubMenuId

Returns the ID of the first sub menu entry (with the given type name as parameter)

mainMenuId string

ID of the main menu entry e.g. to leave the sub menu. Equals to the id, if it already is a main menu entry

hiddenFieldsId boolean

ID of the embedded hidden field, that contains all public information of the described entry as JSON.

hiddenFields boolean

Parses the JSON inside the "hiddenFieldsId"-Element and returns the object with the described entry.

isFirstElement boolean

true, if it is the first element in the list

isSubMenu boolean

true, if it is the ID of an sub menu entry

Source:

MenuEntryNotFoundHandler(properties)

This callback will be called, if there is not next or previous menu entry to navigate to. The implementation can decide, what to do using the given id properties.

Parameters:
Name Type Description
properties module:searchmenu.ListElementIdProperties

of the element id

Source:

NavigateToFunction(destinationUrl)

This function will be called to navigate to a selected search result url.

Parameters:
Name Type Description
destinationUrl String
Source:

ResolveTemplateFunction(template) → {String}

Parameters:
Name Type Description
template String

may contain variables in double curly brackets. T Typically supported variables would be: {{category}} {{fieldName}}, {{displayName}}, {{abbreviation}}, {{value}}

Source:
Returns:

string with resolved/replaced variables

Type
String

SearchMenuConfig

Type:
  • Object
Properties:
Name Type Attributes Default Description
triggerSearch module:searchmenu.SearchService

triggers search (backend)

convertData module:searchmenu.DataConverter

converts search result data to search ui data. Lets data through unchanged by default.

addPredefinedParametersTo module:searchmenu.searchParameterAdder

adds custom search parameters

onCreatedElement module:searchmenu.ElementCreatedListener

this function will be called when a new HTML is created.

navigateTo module:searchmenu.NavigateToFunction

this function will be called to navigate to a selected search result url.

searchAreaElementId string

id of the whole search area (default="searcharea")

inputElementId string

id of the search input field (default="searchinputtext")

resultsView module:searchmenu.SearchViewDescription

describes the main view containing the search results

detailView module:searchmenu.SearchViewDescription

describes the details view

filterOptionsView module:searchmenu.SearchViewDescription

describes the filter options view

filtersView module:searchmenu.SearchViewDescription

describes the filters view

waitBeforeClose string <optional>
700

timeout in milliseconds when search is closed after blur (loss of focus) (default=700)

waitBeforeSearch string <optional>
500

time in milliseconds to wait until typing is finished and search starts (default=500)

waitBeforeMouseOver string <optional>
700

time in milliseconds to wait until mouse over opens details (default=700)

Source:

SearchParameterAdder(searchParametersObject)

This function adds predefined search parameters before search is triggered, e.g. constants, environment parameters, ...

Parameters:
Name Type Description
searchParametersObject Object
Source:

SearchService(searchParameters, onSearchResultsAvailable)

This function will be called to trigger search (calling the search backend).

Parameters:
Name Type Description
searchParameters Object

object that contains all parameters as properties. It will be converted to JSON.

onSearchResultsAvailable module:searchmenu.SearchServiceResultAvailable

will be called when search results are available.

Source:

SearchUiData

Type:
  • Object
Properties:
Name Type Attributes Default Description
category String <optional>
""

name of the category. Default = "". Could contain a short domain name. (e.g. "city")

fieldName String

field name that will be used e.g. as a search parameter name for filter options.

displayName String <optional>
""

readable display name for e.g. the list of results.

abbreviation String <optional>
""

one optional character, a symbol character or a short abbreviation of the category

value String

value of the field

details Array.<module:searchmenu.SearchUiData>

if there are further details that will be displayed e.g. on mouse over

options Array.<module:searchmenu.SearchUiData>

contains filter options that can be selected as search parameters

default Array.<module:searchmenu.SearchUiData>

array with one element representing the default filter option (selected automatically)

summaries Array.<module:searchmenu.SearchUiData>

fields that are used to display the main search entry/result

urltemplate Array.<module:searchmenu.SearchUiData>

contains a single field with the value of the url template. Marks the entry as navigation target.

Source:

SearchViewDescription

Describes a part of the search view (e.g. search result details).

Type:
  • Object
Properties:
Name Type Attributes Default Description
viewElementId string

id of the element (e.g. "div"), that contains the view with all list elements and their parent.

listParentElementId string

id of the element (e.g. "ul"), that contains all list entries and is located inside the view.

listEntryElementIdPrefix string

id prefix (followed by "--" and the index number) for every list entry

listEntryElementTag string <optional>
"li"

element tag for list entries. defaults to "li".

listEntryTextTemplate string <optional>
"{{displayName}}: {{value}}"

template for the text of each list entry

listEntrySummaryTemplate string <optional>
"{{summaries[0].displayName}}: {{summaries[0].value}}"

template for the text of each list entry, if the data group "summary" exists.

listEntryStyleClassTemplate string <optional>
"{{view.listEntryElementIdPrefix}} {{category}}"

template for the style class of each list entry.

isSelectableFilterOption boolean <optional>
false

Specifies, if the list entry can be selected as filter option

Source:

SubMenuId(type)

This function returns the ID for the first sub menu entry using the given type name (= name of the sub menu).

Parameters:
Name Type Description
type string

name of the sub menu entries

Source:

TemplateResolver(templateToResolve, sourceObject) → {module:searchmenu.SearchUiData}

This function replaces variables in double curly brackets with the property values of the given object.

Parameters:
Name Type Description
templateToResolve String

may contain variables in double curly brackets e.g. like "{{searchtext}}".

sourceObject Object

the fields of this object are used to replace the variables in the template

Source:
Returns:

converted and structured data for search UI

Type
module:searchmenu.SearchUiData

SearchServiceResultAvailable(searchResultData)

This function will be called, when search results are available.

Parameters:
Name Type Description
searchResultData Object

already parsed data object containing the result of the search

Source: