feat: improve multiselect field
This commit is contained in:
1 parent
21ed817a63
commit
39904806f5
4 files changed
+2669
-3074
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
import { useClickOutside } from 'stimulus-use'
|
||||
|
||||
export default class extends Controller {
|
||||
|
||||
@@ -7,6 +8,7 @@ export default class extends Controller {
|
||||
|
||||
connect() {
|
||||
this.update()
|
||||
useClickOutside(this)
|
||||
}
|
||||
|
||||
toggle() {
|
||||
@@ -27,4 +29,9 @@ export default class extends Controller {
|
||||
this.labelTarget.innerText = this.placeholderValue
|
||||
}
|
||||
}
|
||||
|
||||
clickOutside(e) {
|
||||
e.preventDefault()
|
||||
this.dropdownTarget.classList.toggle('hidden', true)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user