mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-15 20:16:39 +02:00
88f63faa0b
* Enforce curly braces around conditionals * Install sort class members + update rules * Satisfy linting changes * Add todo * Add tests for clearChoices * Update eslint-plugin-prettier to latest * Resolve conflicts * Fix linting errors
21 lines
520 B
JavaScript
21 lines
520 B
JavaScript
import WrappedElement from './wrapped-element';
|
|
|
|
export default class WrappedInput extends WrappedElement {
|
|
constructor({ element, classNames, delimiter }) {
|
|
super({ element, classNames });
|
|
this.delimiter = delimiter;
|
|
}
|
|
|
|
get value() {
|
|
return this.element.value;
|
|
}
|
|
|
|
set value(items) {
|
|
const itemValues = items.map(({ value }) => value);
|
|
const joinedValues = itemValues.join(this.delimiter);
|
|
|
|
this.element.setAttribute('value', joinedValues);
|
|
this.element.value = joinedValues;
|
|
}
|
|
}
|