Merge branch 'feature/modularise-code' of github.com:jshjohnson/Choices into feature/modularise-code

This commit is contained in:
Josh Johnson 2017-09-29 13:27:26 +01:00
commit 498e45f6db
7 changed files with 9 additions and 9 deletions

View file

@ -408,7 +408,7 @@ const example = new Choices(element, {
### renderSelectedChoices ### renderSelectedChoices
**Type:** `String` **Default:** `auto` **Type:** `String` **Default:** `auto`
**Input types affected:** `select-one`, `select-multiple` **Input types affected:** `select-multiple`
**Usage:** Whether selected choices should be removed from the list. By default choices are removed when they are selected in multiple select box. To always render choices pass `always`. **Usage:** Whether selected choices should be removed from the list. By default choices are removed when they are selected in multiple select box. To always render choices pass `always`.

View file

@ -74,7 +74,7 @@
}, },
"dependencies": { "dependencies": {
"classnames": "^2.2.5", "classnames": "^2.2.5",
"fuse.js": "^2.2.2", "fuse.js": "^3.1.0",
"redux": "^3.3.1" "redux": "^3.3.1"
}, },
"npmName": "choices.js", "npmName": "choices.js",

View file

@ -428,7 +428,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (_this.isSelectOneElement) { if (_this.isSelectOneElement) {
return choice.groupId === group.id; return choice.groupId === group.id;
} }
return choice.groupId === group.id && !choice.selected; return choice.groupId === group.id && (_this.config.renderSelectedChoices === 'always' || !choice.selected);
}); });
if (groupChoices.length >= 1) { if (groupChoices.length >= 1) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -345,7 +345,7 @@ class Choices {
if (this.isSelectOneElement) { if (this.isSelectOneElement) {
return choice.groupId === group.id; return choice.groupId === group.id;
} }
return choice.groupId === group.id && !choice.selected; return choice.groupId === group.id && (this.config.renderSelectedChoices === 'always' || !choice.selected);
}); });
if (groupChoices.length >= 1) { if (groupChoices.length >= 1) {

View file

@ -71,7 +71,7 @@ const choices = (state = [], action) => {
// Set active state based on whether choice is // Set active state based on whether choice is
// within filtered results // within filtered results
choice.active = filteredResults.some((result) => { choice.active = filteredResults.some((result) => {
if (result.item.id === choice.id) { if (result.id === choice.id) {
choice.score = result.score; choice.score = result.score;
return true; return true;
} }