Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { alias } from '@ember/object/computed';
import { assert } from '@ember/debug';
import { isNone } from '@ember/utils';
import { defineProperty, computed } from '@ember/object';
import PowerSelect from 'ember-power-select/components/power-select';
import layout from '../templates/components/paper-autocomplete';
import ValidationMixin from 'ember-paper/mixins/validation-mixin';
import ChildMixin from 'ember-paper/mixins/child-mixin';
import { indexOfOption } from 'ember-power-select/utils/group-utils';
import calculatePosition from '../utils/calculate-ac-position';
/**
* @class PaperAutocomplete
* @extends PowerSelectComponent
*/
export default PowerSelect.extend(ValidationMixin, ChildMixin, {
layout,
calculatePosition,
triggerComponent: 'paper-autocomplete-trigger',
contentComponent: 'paper-autocomplete-content',
optionsComponent: 'paper-autocomplete-options',
triggerWrapperComponent: 'paper-autocomplete-trigger-container',
onfocus: alias('onFocus'),
onblur: alias('onBlur'),
onchange: null,
oninput: null,
searchText: '',
defaultHighlighted: null, // Don't automatically highlight any option
_onChangeNop() { },
extra: computed('labelPath', 'label', function() {
import PowerSelectComponent from 'ember-power-select/components/power-select';
import { get, computed } from '@ember/object';
import { inject as service } from '@ember/service';
// Override `ember-power-select` to support intl messages
export default PowerSelectComponent.extend({
intl: service(),
loadingMessage: computed('intl.locale', function() {
return get(this, 'intl').t('selects.loading');
}),
noMatchesMessage: computed('intl.locale', function() {
return get(this, 'intl').t('selects.none');
}),
searchMessage: computed('intl.locale', function() {
return get(this, 'intl').t('selects.search');
})
});
import PowerSelect from 'ember-power-select/components/power-select';
import layout from '../../templates/components/model-select/power-select';
export default PowerSelect.extend({
layout,
init(){
this._super(...arguments);
if(this.get('withCreate')){
this.set('mustShowNoMessages', false);
}
}
});
import Ember from 'ember';
import EmberPowerSelectComponent from 'ember-power-select/components/power-select';
export default EmberPowerSelectComponent.extend({
init() {
this._super(...arguments);
Ember.deprecate('The name of the component has been shortened from {{ember-power-select}} to just {{power-select}}. The old component will be removed in the next major version.', false);
}
});
import EmberPowerSelect from 'ember-power-select/components/power-select';
import FormSelectMixin from 'travis/mixins/components/form-select';
export default EmberPowerSelect.extend(FormSelectMixin, {
});
import ValidationMixin from 'ember-paper/mixins/validation-mixin';
import ChildMixin from 'ember-paper/mixins/child-mixin';
import FocusableMixin from 'ember-paper/mixins/focusable-mixin';
function concatWithProperty(strings, property) {
if (property) {
strings.push(property);
}
return strings.join(' ');
}
/**
* @class PaperSelect
* @extends PaperInput
*/
export default PowerSelect.extend(ValidationMixin, ChildMixin, FocusableMixin, {
layout,
tagName: 'md-input-container',
onchange: alias('onChange'),
optionsComponent: 'paper-select-options',
triggerComponent: 'paper-select-trigger',
beforeOptionsComponent: 'paper-select-search',
classNameBindings: ['isInvalidAndTouched:md-input-invalid', 'selected:md-input-has-value', 'focusedAndSelected:md-input-focused'],
searchEnabled: false,
validationProperty: 'selected',
isTouched: false,
isInvalidAndTouched: and('isInvalid', 'isTouched'),
attributeBindings: ['parentTabindex:tabindex'],
shouldShowLabel: and('label', 'selected'),
focusedAndSelected: and('focused', 'selected'),
didReceiveAttrs() {