mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
20 lines
404 B
JavaScript
20 lines
404 B
JavaScript
import { Controller } from "stimulus"
|
|
import TomSelect from "tom-select"
|
|
|
|
export default class extends Controller {
|
|
static defaults = {
|
|
maxItems: 1,
|
|
maxOptions: null,
|
|
plugins: ["dropdown_input"],
|
|
allowEmptyOption: true,
|
|
}
|
|
|
|
connect() {
|
|
this.control = new TomSelect(this.element, this.constructor.defaults)
|
|
}
|
|
|
|
disconnect() {
|
|
if (this.control) this.control.destroy()
|
|
}
|
|
}
|