- this.keyboardEventsManager.change.subscribe(
- val => {
- event.items.forEach(e => e.active = false)
- this.keyboardEventsManager.activeItem.active = true
+
+ this.areSuggestionsOpened = true
+ this.results = []
+
+ if (!this.search) return
+
+ if (searchIndexConfig.enabled === false || searchIndexConfig.disableLocalSearch !== true) {
+ this.results.push({
+ text: this.search,
+ type: 'search-instance',
+ default: this.activeSearch === 'search-instance'
+ })
+ }
+
+ if (searchIndexConfig.enabled) {
+ this.results.push({
+ text: this.search,
+ type: 'search-index',
+ default: this.activeSearch === 'search-index'
+ })
+ }
+
+ this.scheduleKeyboardEventsInit = true
+ }
+
+ updateItemsState (index?: number) {
+ if (index !== undefined) {
+ this.keyboardEventsManager.setActiveItem(index)
+ }
+
+ for (const item of this.suggestionItems) {
+ if (this.keyboardEventsManager.activeItem && this.keyboardEventsManager.activeItem === item) {
+ item.active = true
+ this.activeSearch = item.result.type
+ continue