@fleetbase/ember-ui
Version:
Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.
22 lines (19 loc) • 675 B
JavaScript
import PowerSelectMultipleComponent from 'ember-power-select/components/power-select-multiple';
import { action } from '@ember/object';
/**
* This is a wrapper around the normal model-select component. The same arguments apply.
*
* @yield {object} model
*
* @class ModelSelectMultipleComponent
*/
export default class ModelSelectMultipleComponent extends PowerSelectMultipleComponent {
change(option, select) {
const suggestion = option.find((item) => item.__isSuggestion__);
if (suggestion) {
this.args.onCreate(suggestion.__value__, select);
} else {
this.args.onChange(option, select);
}
}
}