mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
Allow initializing with custom TomSelect configurations
This commit is contained in:
@@ -2,15 +2,18 @@ import { Controller } from "stimulus"
|
||||
import TomSelect from "tom-select"
|
||||
|
||||
export default class extends Controller {
|
||||
static values = { options: Object }
|
||||
static defaults = {
|
||||
maxItems: 1,
|
||||
maxOptions: null,
|
||||
plugins: ["dropdown_input"],
|
||||
allowEmptyOption: true,
|
||||
allowEmptyOption: true
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.control = new TomSelect(this.element, this.constructor.defaults)
|
||||
this.control = new TomSelect(
|
||||
this.element, { ...this.constructor.defaults, ...this.optionsValue }
|
||||
)
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
|
||||
Reference in New Issue
Block a user