mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-08 08:52:19 +02:00
Codebeat fixes
This commit is contained in:
parent
1b7b3045b8
commit
9ac62aec31
|
@ -1,12 +1,8 @@
|
|||
# Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![CDNJS](https://img.shields.io/cdnjs/v/choices.js.svg)](https://cdnjs.com/libraries/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js)
|
||||
# Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![CDNJS](https://img.shields.io/cdnjs/v/choices.js.svg)](https://cdnjs.com/libraries/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js) [![codebeat badge](https://codebeat.co/badges/07c7b2d9-d5aa-4772-9fbb-a153e62d0f81)](https://codebeat.co/projects/github-com-jshjohnson-choices-develop)
|
||||
A vanilla, lightweight (~20kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
|
||||
|
||||
[Demo](https://joshuajohnson.co.uk/Choices/)
|
||||
|
||||
---
|
||||
### 👉 Please use [develop](https://github.com/jshjohnson/Choices/tree/develop) as the base branch for pull requests 👈
|
||||
---
|
||||
|
||||
## TL;DR
|
||||
* Lightweight
|
||||
* No jQuery dependency
|
||||
|
|
|
@ -117,6 +117,7 @@ class Choices {
|
|||
this._wasTap = true;
|
||||
this._placeholderValue = this._generatePlaceholderValue();
|
||||
this._baseId = generateId(this.passedElement.element, 'choices-');
|
||||
this._direction = this.passedElement.element.getAttribute('dir') || 'ltr';
|
||||
this._idNames = {
|
||||
itemChoice: 'item-choice',
|
||||
};
|
||||
|
@ -1658,54 +1659,43 @@ class Choices {
|
|||
}
|
||||
|
||||
_createElements() {
|
||||
const direction = this.passedElement.element.getAttribute('dir') || 'ltr';
|
||||
const containerOuter = this._getTemplate(
|
||||
this.containerOuter = new Container({
|
||||
element: this._getTemplate(
|
||||
'containerOuter',
|
||||
direction,
|
||||
this._direction,
|
||||
this._isSelectElement,
|
||||
this._isSelectOneElement,
|
||||
this.config.searchEnabled,
|
||||
this.passedElement.element.type,
|
||||
);
|
||||
const containerInner = this._getTemplate('containerInner');
|
||||
const itemList = this._getTemplate('itemList', this._isSelectOneElement);
|
||||
const choiceList = this._getTemplate(
|
||||
'choiceList',
|
||||
this._isSelectOneElement,
|
||||
);
|
||||
const input = this._getTemplate('input');
|
||||
const dropdown = this._getTemplate('dropdown');
|
||||
|
||||
this.containerOuter = new Container({
|
||||
element: containerOuter,
|
||||
),
|
||||
classNames: this.config.classNames,
|
||||
type: this.passedElement.element.type,
|
||||
position: this.config.position,
|
||||
});
|
||||
|
||||
this.containerInner = new Container({
|
||||
element: containerInner,
|
||||
element: this._getTemplate('containerInner'),
|
||||
classNames: this.config.classNames,
|
||||
type: this.passedElement.element.type,
|
||||
position: this.config.position,
|
||||
});
|
||||
|
||||
this.input = new Input({
|
||||
element: input,
|
||||
element: this._getTemplate('input'),
|
||||
classNames: this.config.classNames,
|
||||
type: this.passedElement.element.type,
|
||||
});
|
||||
|
||||
this.choiceList = new List({
|
||||
element: choiceList,
|
||||
element: this._getTemplate('choiceList', this._isSelectOneElement),
|
||||
});
|
||||
|
||||
this.itemList = new List({
|
||||
element: itemList,
|
||||
element: this._getTemplate('itemList', this._isSelectOneElement),
|
||||
});
|
||||
|
||||
this.dropdown = new Dropdown({
|
||||
element: dropdown,
|
||||
element: this._getTemplate('dropdown'),
|
||||
classNames: this.config.classNames,
|
||||
type: this.passedElement.element.type,
|
||||
});
|
||||
|
@ -1853,10 +1843,7 @@ class Choices {
|
|||
_addPredefinedItems() {
|
||||
const handlePresetItem = item => {
|
||||
const itemType = getType(item);
|
||||
if (itemType === 'Object') {
|
||||
if (!item.value) {
|
||||
return;
|
||||
}
|
||||
if (itemType === 'Object' && item.value) {
|
||||
this._addItem({
|
||||
value: item.value,
|
||||
label: item.label,
|
||||
|
|
Loading…
Reference in a new issue