mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-04 06:43:15 +02:00
Move to 2 space indentation + editorconfig
This commit is contained in:
parent
9bb9e0b4c2
commit
d40841d8dd
9
.editorconfig
Normal file
9
.editorconfig
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
|
@ -10,7 +10,7 @@
|
||||||
"rules": {
|
"rules": {
|
||||||
"quotes": [2, "single"],
|
"quotes": [2, "single"],
|
||||||
"strict": [2, "never"],
|
"strict": [2, "never"],
|
||||||
"indent": ["error", 4, {"SwitchCase": 1}],
|
"indent": ["error", 2, {"SwitchCase": 1}],
|
||||||
"eol-last": "off",
|
"eol-last": "off",
|
||||||
"arrow-body-style": "off",
|
"arrow-body-style": "off",
|
||||||
"no-underscore-dangle": "off",
|
"no-underscore-dangle": "off",
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
activateChoices,
|
activateChoices,
|
||||||
addGroup,
|
addGroup,
|
||||||
clearAll,
|
clearAll,
|
||||||
} from './actions/index';
|
}
|
||||||
|
from './actions/index';
|
||||||
import {
|
import {
|
||||||
isScrolledIntoView,
|
isScrolledIntoView,
|
||||||
getAdjacentEl,
|
getAdjacentEl,
|
||||||
|
@ -21,14 +22,16 @@ import {
|
||||||
getWidthOfInput,
|
getWidthOfInput,
|
||||||
sortByAlpha,
|
sortByAlpha,
|
||||||
sortByScore,
|
sortByScore,
|
||||||
} from './lib/utils.js';
|
}
|
||||||
|
from './lib/utils.js';
|
||||||
import './lib/polyfills.js';
|
import './lib/polyfills.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choices
|
* Choices
|
||||||
*/
|
*/
|
||||||
export default class Choices {
|
export
|
||||||
|
default class Choices {
|
||||||
constructor(element = '[data-choice]', userConfig = {}) {
|
constructor(element = '[data-choice]', userConfig = {}) {
|
||||||
// If there are multiple elements, create a new instance
|
// If there are multiple elements, create a new instance
|
||||||
// for each element besides the first one (as that already has an instance)
|
// for each element besides the first one (as that already has an instance)
|
||||||
|
@ -808,7 +811,9 @@ export default class Choices {
|
||||||
this._removeItem(lastItem);
|
this._removeItem(lastItem);
|
||||||
this._triggerChange(lastItem.value);
|
this._triggerChange(lastItem.value);
|
||||||
} else {
|
} else {
|
||||||
if (!hasHighlightedItems) { this.highlightItem(lastItem); }
|
if (!hasHighlightedItems) {
|
||||||
|
this.highlightItem(lastItem);
|
||||||
|
}
|
||||||
this.removeHighlightedItems();
|
this.removeHighlightedItems();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2045,7 +2050,9 @@ export default class Choices {
|
||||||
this._highlightChoice();
|
this._highlightChoice();
|
||||||
} else {
|
} else {
|
||||||
// Otherwise show a notice
|
// Otherwise show a notice
|
||||||
const dropdownItem = this.isSearching ? this._getTemplate('notice', this.config.noResultsText) : this._getTemplate('notice', this.config.noChoicesText);
|
const dropdownItem = this.isSearching ?
|
||||||
|
this._getTemplate('notice', this.config.noResultsText) :
|
||||||
|
this._getTemplate('notice', this.config.noChoicesText);
|
||||||
this.choiceList.appendChild(dropdownItem);
|
this.choiceList.appendChild(dropdownItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
// Production steps of ECMA-262, Edition 6, 22.1.2.1
|
// Production steps of ECMA-262, Edition 6, 22.1.2.1
|
||||||
// Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
|
// Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
|
||||||
if (!Array.from) {
|
if (!Array.from) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capitalises the first letter of each word in a string
|
* Capitalises the first letter of each word in a string
|
||||||
* @param {String} str String to capitalise
|
* @param {String} str String to capitalise
|
||||||
|
|
|
@ -4,8 +4,8 @@ import rootReducer from './../reducers/index.js';
|
||||||
export default class Store {
|
export default class Store {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.store = createStore(
|
this.store = createStore(
|
||||||
rootReducer,
|
rootReducer
|
||||||
window.devToolsExtension ? window.devToolsExtension() : undefined
|
, window.devToolsExtension ? window.devToolsExtension() : undefined
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue