mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-09 09:22:19 +02:00
remove redundant CSS (#697)
* remove redundant CSS * fix error with lack of test for false * destruct dataset * fix typo
This commit is contained in:
parent
bef6743c3b
commit
69582349bb
|
@ -822,8 +822,9 @@ class Choices {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are clicking on an option
|
// If we are clicking on an option
|
||||||
const id = element.getAttribute('data-id');
|
const { id } = element.dataset;
|
||||||
const choice = this._store.getChoiceById(id);
|
const choice = this._store.getChoiceById(id);
|
||||||
|
if (!choice) return;
|
||||||
const passedKeyCode =
|
const passedKeyCode =
|
||||||
activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;
|
activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;
|
||||||
const hasActiveDropdown = this.dropdown.isActive;
|
const hasActiveDropdown = this.dropdown.isActive;
|
||||||
|
@ -835,7 +836,7 @@ class Choices {
|
||||||
choice,
|
choice,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (choice && !choice.selected && !choice.disabled) {
|
if (!choice.selected && !choice.disabled) {
|
||||||
const canAddItem = this._canAddItem(activeItems, choice.value);
|
const canAddItem = this._canAddItem(activeItems, choice.value);
|
||||||
|
|
||||||
if (canAddItem.response) {
|
if (canAddItem.response) {
|
||||||
|
@ -855,7 +856,7 @@ class Choices {
|
||||||
|
|
||||||
this.clearInput();
|
this.clearInput();
|
||||||
|
|
||||||
// We wont to close the dropdown if we are dealing with a single select box
|
// We want to close the dropdown if we are dealing with a single select box
|
||||||
if (hasActiveDropdown && this._isSelectOneElement) {
|
if (hasActiveDropdown && this._isSelectOneElement) {
|
||||||
this.hideDropdown(true);
|
this.hideDropdown(true);
|
||||||
this.containerOuter.focus();
|
this.containerOuter.focus();
|
||||||
|
|
|
@ -139,11 +139,13 @@ export default class Store {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get single choice by it's ID
|
* Get single choice by it's ID
|
||||||
* @return {Object} Found choice
|
* @param {id} string
|
||||||
|
* @return {import('../../../types/index').Choices.Choice | false} Found choice
|
||||||
*/
|
*/
|
||||||
getChoiceById(id) {
|
getChoiceById(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
return this.activeChoices.find(choice => choice.id === parseInt(id, 10));
|
const n = parseInt(id, 10);
|
||||||
|
return this.activeChoices.find(choice => choice.id === n);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,12 +343,4 @@ $choices-icon-cross-inverse: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiI
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.#{$choices-selector}__input[hidden],
|
|
||||||
.#{$choices-selector}[data-type*='select-one']
|
|
||||||
.#{$choices-selector}__input[hidden],
|
|
||||||
.#{$choices-selector}[data-type*='select-multiple']
|
|
||||||
.#{$choices-selector}__input[hidden] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===== End of Choices ======*/
|
/*===== End of Choices ======*/
|
||||||
|
|
Loading…
Reference in a new issue