Version 2.8.0

This commit is contained in:
Josh Johnson 2017-05-09 09:09:58 +01:00
parent 4f03f7310c
commit e232f7ce6d
6 changed files with 139 additions and 279 deletions

View file

@ -1,8 +1,4 @@
<<<<<<< HEAD
/*! choices.js v2.7.8 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
=======
/*! choices.js v2.5.0 | (c) 2016 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
>>>>>>> 291143b... Add dist files
/*! choices.js v2.8.0 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
@ -57,14 +53,14 @@ return /******/ (function(modules) { // webpackBootstrap
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/***/ }),
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -509,18 +505,6 @@ return /******/ (function(modules) { // webpackBootstrap
// append it and highlight the first choice
this.choiceList.appendChild(choiceListFragment);
} else {
<<<<<<< HEAD
// Otherwise show a notice
var dropdownItem = void 0;
var notice = void 0;
if (this.isSearching) {
notice = (0, _utils.isType)('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText;
dropdownItem = this._getTemplate('notice', notice);
} else {
notice = (0, _utils.isType)('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText;
dropdownItem = this._getTemplate('notice', notice);
=======
var activeItems = this.store.getItemsFilteredByActive();
var canAddItem = this._canAddItem(activeItems, this.input.value);
var dropdownItem = this._getTemplate('notice', this.config.noChoicesText);
@ -529,7 +513,6 @@ return /******/ (function(modules) { // webpackBootstrap
dropdownItem = this._getTemplate('notice', canAddItem.notice);
} else if (this.isSearching) {
dropdownItem = this._getTemplate('notice', this.config.noResultsText);
>>>>>>> 291143b... Add dist files
}
this.choiceList.appendChild(dropdownItem);
@ -775,7 +758,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.dropdown.setAttribute('aria-expanded', 'true');
var dimensions = this.dropdown.getBoundingClientRect();
var dropdownPos = Math.ceil(dimensions.top + window.scrollY + dimensions.height);
var dropdownPos = Math.ceil(dimensions.top + window.scrollY + this.dropdown.offsetHeight);
// If flip is enabled and the dropdown bottom position is greater than the window height flip the dropdown.
var shouldFlip = false;
@ -787,8 +770,6 @@ return /******/ (function(modules) { // webpackBootstrap
if (shouldFlip) {
this.containerOuter.classList.add(this.config.classNames.flippedState);
} else {
this.containerOuter.classList.remove(this.config.classNames.flippedState);
}
// Optionally focus the input if we have a search input
@ -1459,26 +1440,13 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.input === document.activeElement) {
// Check that we have a value to search and the input was an alphanumeric character
if (value && value.length > this.config.searchFloor) {
<<<<<<< HEAD
// Check flag to filter search input
if (this.config.searchChoices) {
// Filter available choices
this._searchChoices(value);
=======
// Filter available choices
var results = this._searchChoices(value);
if (results) {
this.store.dispatch((0, _index3.filterChoices)(results));
}
// Run callback if it is a function
if (callback) {
if ((0, _utils.isType)('Function', callback)) {
callback.call(this, value);
} else {
console.error('callbackOnSearch: Callback is not a function');
var results = this._searchChoices(value);
if (results) {
this.store.dispatch((0, _index3.filterChoices)(results));
}
>>>>>>> 291143b... Add dist files
}
// Trigger search event
(0, _utils.triggerEvent)(this.passedElement, 'search', {
@ -1622,120 +1590,77 @@ return /******/ (function(modules) { // webpackBootstrap
};
var onEnterKey = function onEnterKey() {
var highlighted = _this17.dropdown.querySelector('.' + _this17.config.classNames.highlightedState);
var highlighted = _this16.dropdown.querySelector('.' + _this16.config.classNames.highlightedState);
if (hasActiveDropdown && highlighted) {
// If we have a highlighted choice, select it
_this17._handleChoiceAction(activeItems, highlighted);
_this16._handleChoiceAction(activeItems, highlighted);
} else if (passedElementType === 'select-one') {
// Open single select dropdown if it's not active
if (!hasActiveDropdown) {
_this17.showDropdown(true);
_this16.showDropdown(true);
e.preventDefault();
}
}
// If enter key is pressed and the input has a value
<<<<<<< HEAD
if (passedElementType === 'text' && target.value) {
if (target.value) {
var value = _this16.input.value;
var canAddItem = _this16._canAddItem(activeItems, value);
=======
if (target.value) {
<<<<<<< HEAD
var value = _this17.input.value;
var canAddItem = _this17._canAddItem(activeItems, value);
>>>>>>> 291143b... Add dist files
// All is good, add
if (canAddItem.response) {
<<<<<<< HEAD
if (hasActiveDropdown) {
_this16.hideDropdown();
}
<<<<<<< HEAD
_this16._addItem(value);
_this16._triggerChange(value);
_this16.clearInput(_this16.passedElement);
=======
=======
// Track whether we will end up adding an item
var willAddItem = _this17.isTextElement || _this17.isSelectElement && _this17.config.addItems;
>>>>>>> acb2451... Update dist files, after FF from main repo
=======
(function () {
var value = _this17.input.value;
var canAddItem = _this17._canAddItem(activeItems, value);
var willAddItem = _this16.isTextElement || _this16.isSelectElement && _this16.config.addItems;
// All is good, add
if (canAddItem.response) {
// Track whether we will end up adding an item
var willAddItem = _this17.isTextElement || _this17.isSelectElement && _this17.config.addItems;
>>>>>>> c4dd94f... Update dist files
if (willAddItem) {
if (hasActiveDropdown) {
_this17.hideDropdown();
}
if (_this17.isTextElement) {
_this17._addItem(value);
} else {
var matchingChoices = [];
var isUnique = void 0;
var duplicateItems = _this17.config.duplicateItems;
if (!duplicateItems) {
matchingChoices = _this17.store.getChoices().filter(function (choice) {
return choice.label === value.trim();
});
isUnique = !_this17.store.getItemsFilteredByActive().some(function (item) {
return item.label === value.trim();
});
}
if (duplicateItems || matchingChoices.length === 0 && isUnique) {
_this17._addChoice(true, false, value, value);
}
if (duplicateItems || isUnique) {
if (matchingChoices[0]) {
_this17._addItem(matchingChoices[0].value, matchingChoices[0].label, matchingChoices[0].id);
}
}
_this17.containerOuter.focus();
}
<<<<<<< HEAD
<<<<<<< HEAD
_this17._triggerChange(value);
_this17.clearInput(_this17.passedElement);
>>>>>>> 291143b... Add dist files
=======
_this17._triggerChange(value);
_this17.clearInput(_this17.passedElement);
}
>>>>>>> acb2451... Update dist files, after FF from main repo
}
=======
_this17._triggerChange(value);
_this17.clearInput(_this17.passedElement);
if (willAddItem) {
if (hasActiveDropdown) {
_this16.hideDropdown();
}
if (_this16.isTextElement) {
_this16._addItem(value);
} else {
var matchingChoices = [];
var isUnique = void 0;
var duplicateItems = _this16.config.duplicateItems;
if (!duplicateItems) {
matchingChoices = _this16.store.getChoices().filter(function (choice) {
return choice.label === value.trim();
});
isUnique = !_this16.store.getItemsFilteredByActive().some(function (item) {
return item.label === value.trim();
});
}
if (duplicateItems || matchingChoices.length === 0 && isUnique) {
_this16._addChoice(true, false, value, value);
}
if (duplicateItems || isUnique) {
if (matchingChoices[0]) {
_this16._addItem(matchingChoices[0].value, matchingChoices[0].label, matchingChoices[0].id);
}
}
_this16.containerOuter.focus();
}
_this16._triggerChange(value);
_this16.clearInput(_this16.passedElement);
}
})();
>>>>>>> c4dd94f... Update dist files
}
}
if (target.hasAttribute('data-button')) {
_this16._handleButtonAction(activeItems, target);
e.preventDefault();
}
<<<<<<< HEAD
if (hasActiveDropdown) {
e.preventDefault();
var highlighted = _this16.dropdown.querySelector('.' + _this16.config.classNames.highlightedState);
var _highlighted = _this16.dropdown.querySelector('.' + _this16.config.classNames.highlightedState);
// If we have a highlighted choice
if (highlighted) {
_this16._handleChoiceAction(activeItems, highlighted);
if (_highlighted) {
_this16._handleChoiceAction(activeItems, _highlighted);
}
} else if (passedElementType === 'select-one') {
// Open single select dropdown if it's not active
@ -1744,8 +1669,6 @@ return /******/ (function(modules) { // webpackBootstrap
e.preventDefault();
}
}
=======
>>>>>>> 291143b... Add dist files
};
var onEscapeKey = function onEscapeKey() {
@ -2711,9 +2634,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = Choices;
/***/ },
/***/ }),
/* 2 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
/**
* @license
@ -2814,10 +2737,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {!Object<string, *>} options
*/
function Fuse (list, options) {
var i
var len
var key
var keys
this.list = list
this.options = options = options || {}
@ -2836,7 +2756,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
Fuse.VERSION = '2.6.0'
Fuse.VERSION = '2.7.3'
/**
* Sets a new list for Fuse to match against.
@ -3116,7 +3036,6 @@ return /******/ (function(modules) { // webpackBootstrap
var options = this.options
var getFn = options.getFn
var finalOutput = []
var item
var i
var len
var results = this.results
@ -3176,8 +3095,7 @@ return /******/ (function(modules) { // webpackBootstrap
// since it contains other metadata
for (i = 0, len = results.length; i < len; i++) {
replaceValue(i)
item = getItemAtIndex(i)
finalOutput.push(item)
finalOutput.push(getItemAtIndex(i))
}
return finalOutput
@ -3453,12 +3371,11 @@ return /******/ (function(modules) { // webpackBootstrap
matchMask[j - 1] = 1
}
if (i === 0) {
// First pass: exact match.
bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch
} else {
bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch
if (i !== 0) {
// Subsequent passes: fuzzy match.
bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch | (((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1) | lastBitArr[j + 1]
bitArr[j] |= (((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1) | lastBitArr[j + 1]
}
if (bitArr[j] & this.matchmask) {
score = this._bitapScore(i, j - 1)
@ -3471,13 +3388,13 @@ return /******/ (function(modules) { // webpackBootstrap
bestLoc = j - 1
locations.push(bestLoc)
if (bestLoc > location) {
// When passing loc, don't exceed our current distance from loc.
start = Math.max(1, 2 * location - bestLoc)
} else {
// Already passed loc, downhill from here on in.
// Already passed loc, downhill from here on in.
if (bestLoc <= location) {
break
}
// When passing loc, don't exceed our current distance from loc.
start = Math.max(1, 2 * location - bestLoc)
}
}
}
@ -3545,9 +3462,9 @@ return /******/ (function(modules) { // webpackBootstrap
})(this);
/***/ },
/***/ }),
/* 3 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -3778,9 +3695,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = Store;
/***/ },
/***/ }),
/* 4 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -3829,9 +3746,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.applyMiddleware = _applyMiddleware2['default'];
exports.compose = _compose2['default'];
/***/ },
/***/ }),
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -4095,9 +4012,9 @@ return /******/ (function(modules) { // webpackBootstrap
}, _ref2[_symbolObservable2['default']] = observable, _ref2;
}
/***/ },
/***/ }),
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(7),
getPrototype = __webpack_require__(13),
@ -4163,9 +4080,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = isPlainObject;
/***/ },
/***/ }),
/* 7 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(8),
getRawTag = __webpack_require__(11),
@ -4189,12 +4106,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
<<<<<<< HEAD
return (symToStringTag && symToStringTag in Object(value))
=======
value = Object(value);
return (symToStringTag && symToStringTag in value)
>>>>>>> 291143b... Add dist files
? getRawTag(value)
: objectToString(value);
}
@ -4202,9 +4114,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = baseGetTag;
/***/ },
/***/ }),
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(9);
@ -4214,9 +4126,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = Symbol;
/***/ },
/***/ }),
/* 9 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(10);
@ -4229,9 +4141,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = root;
/***/ },
/***/ }),
/* 10 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
@ -4240,9 +4152,9 @@ return /******/ (function(modules) { // webpackBootstrap
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/***/ }),
/* 11 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(8);
@ -4292,9 +4204,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = getRawTag;
/***/ },
/***/ }),
/* 12 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
@ -4320,9 +4232,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = objectToString;
/***/ },
/***/ }),
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
var overArg = __webpack_require__(14);
@ -4332,9 +4244,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = getPrototype;
/***/ },
/***/ }),
/* 14 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
/**
* Creates a unary function that invokes `func` with its argument transformed.
@ -4353,9 +4265,9 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = overArg;
/***/ },
/***/ }),
/* 15 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
@ -4388,16 +4300,16 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = isObjectLike;
/***/ },
/***/ }),
/* 16 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(17);
/***/ },
/***/ }),
/* 17 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, module) {'use strict';
@ -4430,25 +4342,25 @@ return /******/ (function(modules) { // webpackBootstrap
exports['default'] = result;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(18)(module)))
/***/ },
/***/ }),
/* 18 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ },
/***/ }),
/* 19 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -4474,9 +4386,9 @@ return /******/ (function(modules) { // webpackBootstrap
return result;
};
/***/ },
/***/ }),
/* 20 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -4621,9 +4533,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
}
/***/ },
/***/ }),
/* 21 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -4651,9 +4563,9 @@ return /******/ (function(modules) { // webpackBootstrap
/* eslint-enable no-empty */
}
/***/ },
/***/ }),
/* 22 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -4707,9 +4619,9 @@ return /******/ (function(modules) { // webpackBootstrap
return boundActionCreators;
}
/***/ },
/***/ }),
/* 23 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -4770,9 +4682,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
}
/***/ },
/***/ }),
/* 24 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
"use strict";
@ -4813,9 +4725,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
}
/***/ },
/***/ }),
/* 25 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
@ -4860,9 +4772,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = rootReducer;
/***/ },
/***/ }),
/* 26 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -4928,9 +4840,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = items;
/***/ },
/***/ }),
/* 27 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -4969,9 +4881,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = groups;
/***/ },
/***/ }),
/* 28 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -5089,9 +5001,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.default = choices;
/***/ },
/***/ }),
/* 29 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -5174,9 +5086,9 @@ return /******/ (function(modules) { // webpackBootstrap
};
};
/***/ },
/***/ }),
/* 30 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
"use strict";
@ -5721,9 +5633,9 @@ return /******/ (function(modules) { // webpackBootstrap
return element.dispatchEvent(event);
};
/***/ },
/***/ }),
/* 31 */
/***/ function(module, exports) {
/***/ (function(module, exports) {
'use strict';
@ -5858,7 +5770,7 @@ return /******/ (function(modules) { // webpackBootstrap
window.CustomEvent = CustomEvent;
})();
/***/ }
/***/ })
/******/ ])
});
;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "choices.js",
"version": "2.7.8",
"version": "2.8.0",
"description": "A vanilla JS customisable text input/select box plugin",
"main": [
"./assets/scripts/dist/choices.js",

View file

@ -15,7 +15,7 @@
<meta name="theme-color" content="#ffffff">
<!-- Ignore these -->
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.7.8">
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.8.0">
<!-- End ignore these -->
<!-- Optional includes -->
@ -23,8 +23,8 @@
<!-- End optional includes -->
<!-- Choices includes -->
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.7.8">
<script src="assets/scripts/dist/choices.min.js?version=2.7.8"></script>
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.8.0">
<script src="assets/scripts/dist/choices.min.js?version=2.8.0"></script>
<!-- End Choices includes -->
<!--[if lt IE 9]>

View file

@ -1,6 +1,6 @@
{
"name": "choices.js",
"version": "2.7.8",
"version": "2.8.0",
"description": "A vanilla JS customisable text input/select box plugin",
"main": "./assets/scripts/dist/choices.min.js",
"scripts": {