celerichain-ember-uii
Version:
Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.
34 lines (26 loc) • 867 B
JavaScript
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class SelectComponent extends Component {
value;
placeholder;
constructor(owner, { value, placeholder }) {
super(...arguments);
this.value = value;
this.placeholder = placeholder;
}
changed(el, [value, placeholder]) {
this.value = value;
this.placeholder = placeholder;
}
select(event) {
const { value } = event.target;
this.value = value;
if (typeof this.args.onSelect === 'function') {
this.args.onSelect(value);
}
if (typeof this.args.onChange === 'function') {
this.args.onChange(event, value);
}
}
}