Releases: UrbanCompass/ngc-omnibox
Fix bug where element would get re-focused after blur
Actually fix element blurring bug (#60) Was caused by the highlighted choice being un-set.
Fix field element blur event trickery
Fix field element blur event trickery (#59) See https://github.com/UrbanCompass/ngc-omnibox/compare/blur?expand=1#diff-d8a178e25f29a787558002bb505a778dR59 for details
Fix highlighted choice remaining on omnibox blur
v0.3.2 Fix highlighted choice remaining on omnibox blur (#58)
Fix bug where query wasn't getting cleared
When require match is on, the query should get cleared whenever the model changes since an update to the model is the equivalent of an item getting chosen or unchosen.
This only happens when requireMatch is on since when its off the implementor might allow free text searching.
Add ability to highlight a specific choice from the list of choices
Adds highlightChoice(choice)
function, available on the Omnibox controller, to specify a choice to highlight. Additionally fixes a bug where you couldn't navigate the list of choices via keyboard if the field element already had focus.
Add support for onFocus and onBlur component binding callbacks
v0.2.2 Add support for onFocus and onBlur component binding callbacks (#54)
Fixes bugs with clearing the field and suggestions
Setting the ngModel to null, undefined, or empty string will now correctly clear the field in cases where you want to remove all choices all at once. Also closing the suggestions popup now clears out the list of suggestions, which prevents old results from showing up briefly when the popup re-opens.
API changes, add input hinting, match highlighting, and events
API Changes
All subcomponents of ngc-omnibox-suggestions
now start with ngc-omnibox-suggestions-
instead of ngc-omnibox-suggestion-
for greater consistency and to better denote that they're subcomponents of that directive. This is a breaking change and will require updating your implementations.
Input Hinting
You can now resolve an object in your source()
function Promise with the following format:
Promise.resolve({
suggestions: [...],
hint: 'my query hint'
})
The hint will be shown to the right of the input text. Hitting RIGHT on the keyboard when there's a hint will set the query to the hint's value and re-run the source function. Learn more in the documentation.
Match Highlighting
You can now add a filter inside a suggestion item that adds custom HTML around text that matches the query so that its highlighted. E.g.
<ngc-omnibox-suggestion-item ng-bind-html="suggestion.title | ngcOmniboxHighlightMatch:omnibox.query"></ngc-omnibox-suggestion-item>
More information can be found in the documentation
Events
The following bindings are available on the ngc-omnibox
component as &-bound callbacks:
- choose
- unchoose
- suggestions shown
- suggestions hidden
More information in the new event bindings section of the documentation.
Throw an error if more than one reference of a suggestion subcomponent is found
Also, ditch the part of the README that says the suggestions component will clear its markup, because it just wasn't true. Also, it's useful!
Also added some missing tests.
Fixes bugs with highlighting a choice when didn't mean to
There was a weird issue where if you type in a bunch of text in the input field, then select all and hit backspace, it would delete the text, and then highlight a choice. This was because we were only checking that selection start was the same between key down and key up, which it would be if we selected all and deleted.
To combat this, I'm now also checking selection end to make sure it's the same, which would be the case when the text is deleted since the selection will have collapsed.
Additionally, I added using the DELETE key to to navigate when in the field (so it works as the opposite of BACKSPACE), and restricted using DELETE and BACKSPACE to select choices to only when the field is empty.