@alihbuzaid/ember-ui
Version:
Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.
36 lines (28 loc) • 917 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;
disabled = false;
constructor(owner, { value, placeholder, disabled = false }) {
super(...arguments);
this.value = value;
this.placeholder = placeholder;
this.disabled = disabled;
}
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);
}
}
}