fix navigate component

This commit is contained in:
Matthew Irish 2018-10-05 22:01:02 -05:00
parent 4aa99c3e2c
commit b2e24ce2b1
2 changed files with 16 additions and 14 deletions

View File

@ -163,24 +163,25 @@ export default Component.extend(FocusOnInsertMixin, {
},
actions: {
handleInput: function(event) {
var filter = event.target.value;
handleInput: function(filter) {
this.get('filterDidChange')(filter);
debounce(this, 'filterUpdated', filter, 200);
},
setFilterFocused: function(isFocused) {
this.get('filterFocusDidChange')(isFocused);
console.log(isFocused);
},
handleKeyPress: function(val, event) {
handleKeyPress: function(event) {
if (event.keyCode === keys.TAB) {
this.onTab(event);
}
},
handleKeyUp: function(val, event) {
handleKeyUp: function(event) {
var keyCode = event.keyCode;
let val = event.target.value;
if (keyCode === keys.ENTER) {
this.onEnter(val);
}

View File

@ -1,16 +1,17 @@
<div class="field">
<p class="control has-icons-left has-icons-right">
{{input
value=filter
placeholder=(or placeholder "Filter keys")
<input
class="filter input"
disabled=disabled
key-up=(action "handleKeyUp")
key-down=(action "handleKeyPress")
input=(action "handleInput")
focus-in=(action "setFilterFocused" true)
focus-out=(action "setFilterFocused" false)
}}
disabled={{disabled}}
value={{@filter}}
placeholder={{ or @placeholder "Filter keys" }}
oninput={{action "handleInput" value="target.value"}}
onkeyup={{action "handleKeyUp" }}
onkeydown={{action "handleKeyPress"}}
onfocus={{action "setFilterFocused" true}}
onblur={{action "setFilterFocused" false}}
/>
{{i-con glyph="ios-search-strong" class="is-left has-text-grey" size=18}}
</p>