How to use the ember-inspector/components/ember-flatpickr.extend function in ember-inspector

To help you get started, we’ve selected a few ember-inspector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember-inspector / app / components / date-property-field.js View on Github external
import { scheduleOnce } from '@ember/runloop';
import DatePicker from 'ember-inspector/components/ember-flatpickr';

const KEY_EVENTS = {
  escape: 27
};

export default DatePicker.extend({
  didInsertElement() {
    this._super(...arguments);

    scheduleOnce('afterRender', this, function() {
      this.flatpickrRef.open();
    });
  },

  keyUp(e) {
    if (e.keyCode === KEY_EVENTS.escape) {
      this.flatpickrRef.close();
    }
    return this._super(...arguments);
  }
});