mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-03 06:22:25 +02:00
Add dropdown items
This commit is contained in:
parent
c821c923c9
commit
f05b49578a
2
assets/scripts/dist/bundle.js
vendored
2
assets/scripts/dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
|
@ -36,7 +36,11 @@ export class Choices {
|
||||||
prependValue: false,
|
prependValue: false,
|
||||||
appendValue: false,
|
appendValue: false,
|
||||||
selectAll: true,
|
selectAll: true,
|
||||||
classNames: {},
|
classNames: {
|
||||||
|
input: '',
|
||||||
|
container: '',
|
||||||
|
|
||||||
|
},
|
||||||
callbackOnInit: function() {},
|
callbackOnInit: function() {},
|
||||||
callbackOnRender: function() {},
|
callbackOnRender: function() {},
|
||||||
callbackOnRemoveItem: function() {},
|
callbackOnRemoveItem: function() {},
|
||||||
|
@ -236,6 +240,12 @@ export class Choices {
|
||||||
|
|
||||||
handleClick(item);
|
handleClick(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e.target.hasAttribute('data-choice-selectable')) {
|
||||||
|
let item = e.target;
|
||||||
|
let value = e.target.getAttribute('data-choice-value');
|
||||||
|
this.addItem(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onFocus(e) {
|
onFocus(e) {
|
||||||
|
@ -578,14 +588,14 @@ export class Choices {
|
||||||
|
|
||||||
addEventListeners() {
|
addEventListeners() {
|
||||||
document.addEventListener('keydown', this.onKeyDown);
|
document.addEventListener('keydown', this.onKeyDown);
|
||||||
this.list.addEventListener('click', this.onClick);
|
this.containerOuter.addEventListener('click', this.onClick);
|
||||||
this.input.addEventListener('focus', this.onFocus);
|
this.input.addEventListener('focus', this.onFocus);
|
||||||
this.input.addEventListener('blur', this.onBlur);
|
this.input.addEventListener('blur', this.onBlur);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeEventListeners() {
|
removeEventListeners() {
|
||||||
document.removeEventListener('keydown', this.onKeyDown);
|
document.removeEventListener('keydown', this.onKeyDown);
|
||||||
this.list.removeEventListener('click', this.onClick);
|
this.containerOuter.removeEventListener('click', this.onClick);
|
||||||
this.input.removeEventListener('focus', this.onFocus);
|
this.input.removeEventListener('focus', this.onFocus);
|
||||||
this.input.removeEventListener('blur', this.onBlur);
|
this.input.removeEventListener('blur', this.onBlur);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue