Last active
          April 17, 2018 17:21 
        
      - 
      
- 
        Save gtb104/3d59749b56d8886d993bec77dfc1815a to your computer and use it in GitHub Desktop. 
    keyup Test
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import Component from '@ember/component'; | |
| import { scheduleOnce } from '@ember/runloop'; | |
| import { isEmpty } from '@ember/utils'; | |
| import { computed } from '@ember/object'; | |
| export default Component.extend({ | |
| classNameBindings: ['isActive', ':pill-operator'], | |
| isActive: false, | |
| meta: null, | |
| selection: null, | |
| options: computed('meta', () => { | |
| return [ | |
| { displayName: '=', isExpensive: false, hasValue: true }, | |
| { displayName: '!=', isExpensive: false, hasValue: true }, | |
| { displayName: 'exists', isExpensive: false, hasValue: false }, | |
| { displayName: '!exists', isExpensive: false, hasValue: false } | |
| ] | |
| }), | |
| didUpdateAttrs() { | |
| this._super(...arguments); | |
| if (this.get('isActive')) { | |
| // We schedule this after render to give time for the power-select to | |
| // be rendered before trying to focus on it. | |
| scheduleOnce('afterRender', this, '_focusOnPowerSelectTrigger'); | |
| } | |
| }, | |
| actions: { | |
| onFocus(powerSelectAPI /* event */) { | |
| powerSelectAPI.actions.open(); | |
| } | |
| }, | |
| _focusOnPowerSelectTrigger() { | |
| const trigger = this.element.querySelector('.ember-power-select-trigger input'); | |
| if (trigger) { | |
| trigger.focus(); | |
| } | |
| }, | |
| // Function that power-select uses to make an autosuggest match. This function | |
| // looks at the operators's displayName property for a match. | |
| _matcher: (o, input) => { | |
| const _displayName = o.displayName.toLowerCase(); | |
| const _input = input.toLowerCase(); | |
| return _displayName.indexOf(_input); | |
| } | |
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| meta: { | |
| count: 0, | |
| format: 'Text', | |
| metaName: 'a', | |
| flags: 1, | |
| displayName: 'A' | |
| }, | |
| keyup: () => { | |
| console.log('keyup'); | |
| } | |
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "version": "0.13.1", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "3.0.0", | |
| "ember-template-compiler": "release", | |
| "ember-testing": "release" | |
| }, | |
| "addons": { | |
| "ember-power-select": "1.10.4" | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment