Interface: CosmographSearchConfig<T>
Extends
Type Parameters
Type Parameter |
---|
T |
Properties
accessor?
optional
accessor:string
Data column key to access time values for the CosmographSearch
. Make sure itâs included in pointIncludeColumns
if youâre not using this column as other point accessor.
Default
undefined
Inherited from
CosmographSearchConfigInterface
.accessor
placeholderText?
optional
placeholderText:string
The text to display in the search input placeholder.
Default
'Search...'
Inherited from
CosmographSearchConfigInterface
.placeholderText
showAccessorsMenu?
optional
showAccessorsMenu:boolean
Whether to show the accessors menu.
Default
true
Inherited from
CosmographSearchConfigInterface
.showAccessorsMenu
suggestionFields?
optional
suggestionFields:Record
<string
,string
>
A map of field names (accessors) to their display labels for the suggestion list.
The order of fields in the map determines the display order in the suggestion.
If provided, the suggestion renderer will display these fields and their values.
The main accessor
will be added first if not present in this map.
Example: { âidâ: âPoint IDâ, âweightâ: âWeightâ }
Default
undefined
Inherited from
CosmographSearchConfigInterface
.suggestionFields
suggestionFieldsPalette?
optional
suggestionFieldsPalette:string
[]
An array of CSS-valid colors to use for the suggestion fields. Colors will be applied in order and cycled through if not enough colors are provided.
Default
['#fbb4aebf', '#b3cde3bf', '#ccebc5bf', '#decbe4bf', '#fed9a6bf', '#ffffccbf', '#e5d8bdbf', '#fddaecbf'],
Inherited from
CosmographSearchConfigInterface
.suggestionFieldsPalette
disabled?
optional
disabled:boolean
Whether the search component is disabled.
Default
false
Inherited from
CosmographSearchConfigInterface
.disabled
openListUpwards?
optional
openListUpwards:boolean
Whether to open the suggestion list above the input field instead of below.
Default
false
Inherited from
CosmographSearchConfigInterface
.openListUpwards
onInput()?
optional
onInput: (value
,results
,event
) =>void
Callback invoked when the input value changes. This callback should be used to process the query, retrieve matching items, and return them.
Parameters
Parameter | Type | Description |
---|---|---|
value | string | The current value of the input field |
results | T [] | An array of found items of type T matching the current query |
event | InputEvent | The input event object |
Returns
void
Inherited from
CosmographSearchConfigInterface
.onInput
debounceTime?
optional
debounceTime:number
The debounce duration (in milliseconds) used to delay the onInput callback. Helps prevent excessive callback invocations during rapid typing.
Default
300
Inherited from
CosmographSearchConfigInterface
.debounceTime
searchFn()?
optional
searchFn: (query
,limit?
) =>Promise
<T
[]>
Function that asynchronously retrieves suggestion items based on the search query. This function should process the query to find specific items in the data. The results are then returned to be used in onInput and onEnter callbacks.
Parameters
Parameter | Type | Description |
---|---|---|
query | string | The current search query |
limit? | number | Optional. The maximum number of suggestion items to return |
Returns
Promise
<T
[]>
A promise that resolves to an array of suggestion items of type T
Inherited from
CosmographSearchConfigInterface
.searchFn
suggestionsLimit?
optional
suggestionsLimit:number
The maximum number of suggestions to retrieve and include in the results. When the number of suggestions exceeds this limit, the rest will be omitted. This can be tweaked to improve performance when dealing with large data sets.
Default
50
Inherited from
CosmographSearchConfigInterface
.suggestionsLimit
maxVisibleItems?
optional
maxVisibleItems:number
The maximum items visible in the suggestions dropdown at once. When the number of suggestions exceeds this value, a scrollbar will be added.
Default
10
Inherited from
CosmographSearchConfigInterface
.maxVisibleItems
onSelect()?
optional
onSelect: (suggestion
) =>void
Callback triggered when a suggestion from the autosuggest list is selected.
Parameters
Parameter | Type | Description |
---|---|---|
suggestion | T | The selected suggestion item of type T |
Returns
void
Inherited from
CosmographSearchConfigInterface
.onSelect
suggestionRenderer()?
optional
suggestionRenderer: (suggestion
,value?
) =>string
|HTMLElement
Customize how each suggestion is rendered.
Parameters
Parameter | Type | Description |
---|---|---|
suggestion | T | The suggestion item of type T to render |
value? | string | - |
Returns
string
| HTMLElement
A string containing HTML or an HTMLElement representing the rendered suggestion
Inherited from
CosmographSearchConfigInterface
.suggestionRenderer
selectedSuggestionRenderer()?
optional
selectedSuggestionRenderer: (suggestion
,value?
) =>string
Function to convert a suggestion item to a string for display in the input field after selection.
Parameters
Parameter | Type | Description |
---|---|---|
suggestion | T | The suggestion item to convert |
value? | string | The current value of the input field |
Returns
string
The string representation of the suggestion
Inherited from
CosmographSearchConfigInterface
.selectedSuggestionRenderer
inputClassName?
optional
inputClassName:string
Custom CSS class name to apply to the search input field.
Default
undefined
Inherited from
CosmographSearchConfigInterface
.inputClassName
suggestionListClassName?
optional
suggestionListClassName:string
Custom CSS class name to apply to the autosuggest list container.
Default
undefined
Inherited from
CosmographSearchConfigInterface
.suggestionListClassName
minSearchLength?
optional
minSearchLength:number
The minimum number of characters required to trigger a search.
Default
2
Inherited from
CosmographSearchConfigInterface
.minSearchLength
onEnter()?
optional
onEnter: (value
,results
) =>void
Callback invoked when the return (Enter) key is pressed. This callback should process the current input value to find the matching items and return them.
Parameters
Parameter | Type | Description |
---|---|---|
value | string | The current value of the input field when Enter is pressed |
results | T [] | An array of found items of type T matching the current query |
Returns
void
Inherited from
CosmographSearchConfigInterface
.onEnter
highlightMatch?
optional
highlightMatch:boolean
Whether to highlight the matching text in the suggestions.
Default
true