mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-16 20:55:03 +02:00
Version 2.8.11
This commit is contained in:
parent
21f67b4289
commit
16c114a6e3
62
assets/scripts/dist/choices.js
vendored
62
assets/scripts/dist/choices.js
vendored
|
@ -1,4 +1,4 @@
|
||||||
/*! choices.js v2.8.10 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
/*! choices.js v2.8.11 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||||
(function webpackUniversalModuleDefinition(root, factory) {
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||||||
if(typeof exports === 'object' && typeof module === 'object')
|
if(typeof exports === 'object' && typeof module === 'object')
|
||||||
module.exports = factory();
|
module.exports = factory();
|
||||||
|
@ -118,6 +118,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
silent: false,
|
silent: false,
|
||||||
items: [],
|
items: [],
|
||||||
choices: [],
|
choices: [],
|
||||||
|
renderChoiceLimit: -1,
|
||||||
maxItemCount: -1,
|
maxItemCount: -1,
|
||||||
addItems: true,
|
addItems: true,
|
||||||
removeItems: true,
|
removeItems: true,
|
||||||
|
@ -411,7 +412,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (groupChoices.length >= 1) {
|
if (groupChoices.length >= 1) {
|
||||||
var dropdownGroup = _this._getTemplate('choiceGroup', group);
|
var dropdownGroup = _this._getTemplate('choiceGroup', group);
|
||||||
groupFragment.appendChild(dropdownGroup);
|
groupFragment.appendChild(dropdownGroup);
|
||||||
_this.renderChoices(groupChoices, groupFragment);
|
_this.renderChoices(groupChoices, groupFragment, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -431,11 +432,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
value: function renderChoices(choices, fragment) {
|
value: function renderChoices(choices, fragment) {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
|
var withinGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||||
|
|
||||||
// Create a fragment to store our list items (so we don't have to update the DOM for each item)
|
// Create a fragment to store our list items (so we don't have to update the DOM for each item)
|
||||||
var choicesFragment = fragment || document.createDocumentFragment();
|
var choicesFragment = fragment || document.createDocumentFragment();
|
||||||
var filter = this.isSearching ? _utils.sortByScore : this.config.sortFilter;
|
var _config = this.config,
|
||||||
var renderSelectedChoices = this.config.renderSelectedChoices;
|
renderSelectedChoices = _config.renderSelectedChoices,
|
||||||
|
searchResultLimit = _config.searchResultLimit,
|
||||||
|
renderChoiceLimit = _config.renderChoiceLimit;
|
||||||
|
|
||||||
|
var filter = this.isSearching ? _utils.sortByScore : this.config.sortFilter;
|
||||||
var appendChoice = function appendChoice(choice) {
|
var appendChoice = function appendChoice(choice) {
|
||||||
var shouldRender = renderSelectedChoices === 'auto' ? _this2.isSelectOneElement || !choice.selected : true;
|
var shouldRender = renderSelectedChoices === 'auto' ? _this2.isSelectOneElement || !choice.selected : true;
|
||||||
if (shouldRender) {
|
if (shouldRender) {
|
||||||
|
@ -444,24 +450,32 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// If sorting is enabled or the user is searching, filter choices
|
var rendererableChoices = choices;
|
||||||
if (this.config.shouldSort || this.isSearching) {
|
|
||||||
choices.sort(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isSearching) {
|
if (renderSelectedChoices === 'auto' && !this.isSelectOneElement) {
|
||||||
for (var i = 0; i < this.config.searchResultLimit; i++) {
|
rendererableChoices = choices.filter(function (choice) {
|
||||||
var choice = choices[i];
|
return !choice.selected;
|
||||||
if (choice) {
|
|
||||||
appendChoice(choice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
choices.forEach(function (choice) {
|
|
||||||
return appendChoice(choice);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If sorting is enabled or the user is searching, filter choices
|
||||||
|
if (this.config.shouldSort || this.isSearching) {
|
||||||
|
rendererableChoices.sort(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
var choiceLimit = rendererableChoices.length;
|
||||||
|
|
||||||
|
if (this.isSearching) {
|
||||||
|
choiceLimit = Math.min(searchResultLimit, rendererableChoices.length - 1);
|
||||||
|
} else if (renderChoiceLimit > 0 && !withinGroup) {
|
||||||
|
choiceLimit = Math.min(renderChoiceLimit, rendererableChoices.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add each choice to dropdown within range
|
||||||
|
for (var i = 0; i < choiceLimit; i++) {
|
||||||
|
appendChoice(rendererableChoices[i]);
|
||||||
|
};
|
||||||
|
|
||||||
return choicesFragment;
|
return choicesFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +550,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
// Only render if our state has actually changed
|
// Only render if our state has actually changed
|
||||||
if (this.currentState !== this.prevState) {
|
if (this.currentState !== this.prevState) {
|
||||||
// Choices
|
// Choices
|
||||||
if (this.currentState.choices !== this.prevState.choices || this.currentState.groups !== this.prevState.groups) {
|
if (this.currentState.choices !== this.prevState.choices || this.currentState.groups !== this.prevState.groups || this.currentState.items !== this.prevState.items) {
|
||||||
if (this.isSelectElement) {
|
if (this.isSelectElement) {
|
||||||
// Get active groups/choices
|
// Get active groups/choices
|
||||||
var activeGroups = this.store.getGroupsFilteredByActive();
|
var activeGroups = this.store.getGroupsFilteredByActive();
|
||||||
|
@ -1523,7 +1537,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.highlightPosition = 0;
|
this.highlightPosition = 0;
|
||||||
this.isSearching = true;
|
this.isSearching = true;
|
||||||
this.store.dispatch((0, _index3.filterChoices)(results));
|
this.store.dispatch((0, _index3.filterChoices)(results));
|
||||||
|
|
||||||
|
return results.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1549,14 +1567,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (this.input === document.activeElement) {
|
if (this.input === document.activeElement) {
|
||||||
// Check that we have a value to search and the input was an alphanumeric character
|
// Check that we have a value to search and the input was an alphanumeric character
|
||||||
if (value && value.length >= this.config.searchFloor) {
|
if (value && value.length >= this.config.searchFloor) {
|
||||||
|
var resultCount = 0;
|
||||||
// Check flag to filter search input
|
// Check flag to filter search input
|
||||||
if (this.config.searchChoices) {
|
if (this.config.searchChoices) {
|
||||||
// Filter available choices
|
// Filter available choices
|
||||||
this._searchChoices(value);
|
resultCount = this._searchChoices(value);
|
||||||
}
|
}
|
||||||
// Trigger search event
|
// Trigger search event
|
||||||
(0, _utils.triggerEvent)(this.passedElement, 'search', {
|
(0, _utils.triggerEvent)(this.passedElement, 'search', {
|
||||||
value: value
|
value: value,
|
||||||
|
resultCount: resultCount
|
||||||
});
|
});
|
||||||
} else if (hasUnactiveChoices) {
|
} else if (hasUnactiveChoices) {
|
||||||
// Otherwise reset choices to active
|
// Otherwise reset choices to active
|
||||||
|
|
2
assets/scripts/dist/choices.js.map
vendored
2
assets/scripts/dist/choices.js.map
vendored
File diff suppressed because one or more lines are too long
8
assets/scripts/dist/choices.min.js
vendored
8
assets/scripts/dist/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "choices.js",
|
"name": "choices.js",
|
||||||
"version": "2.8.10",
|
"version": "2.8.11",
|
||||||
"description": "A vanilla JS customisable text input/select box plugin",
|
"description": "A vanilla JS customisable text input/select box plugin",
|
||||||
"main": [
|
"main": [
|
||||||
"./assets/scripts/dist/choices.js",
|
"./assets/scripts/dist/choices.js",
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
<!-- Ignore these -->
|
<!-- Ignore these -->
|
||||||
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.8.10">
|
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.8.11">
|
||||||
<!-- End ignore these -->
|
<!-- End ignore these -->
|
||||||
|
|
||||||
<!-- Optional includes -->
|
<!-- Optional includes -->
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<!-- End optional includes -->
|
<!-- End optional includes -->
|
||||||
|
|
||||||
<!-- Choices includes -->
|
<!-- Choices includes -->
|
||||||
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.8.10">
|
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.8.11">
|
||||||
<script src="assets/scripts/dist/choices.min.js?version=2.8.8"></script>
|
<script src="assets/scripts/dist/choices.min.js?version=2.8.8"></script>
|
||||||
<!-- End Choices includes -->
|
<!-- End Choices includes -->
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "choices.js",
|
"name": "choices.js",
|
||||||
"version": "2.8.10",
|
"version": "2.8.11",
|
||||||
"description": "A vanilla JS customisable text input/select box plugin",
|
"description": "A vanilla JS customisable text input/select box plugin",
|
||||||
"main": "./assets/scripts/dist/choices.min.js",
|
"main": "./assets/scripts/dist/choices.min.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Example usage: npm --newVersion=2.8.10 run version
|
// Example usage: npm --newVersion=2.8.11 run version
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
Loading…
Reference in a new issue