mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-08 00:42:15 +02:00
Version 2.8.12
This commit is contained in:
parent
61dc200bab
commit
55e81d188b
159
assets/scripts/dist/choices.js
vendored
159
assets/scripts/dist/choices.js
vendored
|
@ -1,4 +1,4 @@
|
||||||
/*! choices.js v2.8.11 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
/*! choices.js v2.8.12 | (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();
|
||||||
|
@ -219,6 +219,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this.isSelectElement = this.isSelectOneElement || this.isSelectMultipleElement;
|
this.isSelectElement = this.isSelectOneElement || this.isSelectMultipleElement;
|
||||||
this.isValidElementType = this.isTextElement || this.isSelectElement;
|
this.isValidElementType = this.isTextElement || this.isSelectElement;
|
||||||
this.isIe11 = !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/));
|
this.isIe11 = !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/));
|
||||||
|
this.isScrollingOnIe = false;
|
||||||
|
|
||||||
if (!this.passedElement) {
|
if (!this.passedElement) {
|
||||||
if (!this.config.silent) {
|
if (!this.config.silent) {
|
||||||
|
@ -1604,10 +1605,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
document.addEventListener('mousedown', this._onMouseDown);
|
document.addEventListener('mousedown', this._onMouseDown);
|
||||||
document.addEventListener('mouseover', this._onMouseOver);
|
document.addEventListener('mouseover', this._onMouseOver);
|
||||||
|
|
||||||
if (this.isIe11) {
|
|
||||||
document.addEventListener('focus', this._onDocumentFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isSelectOneElement) {
|
if (this.isSelectOneElement) {
|
||||||
this.containerOuter.addEventListener('focus', this._onFocus);
|
this.containerOuter.addEventListener('focus', this._onFocus);
|
||||||
this.containerOuter.addEventListener('blur', this._onBlur);
|
this.containerOuter.addEventListener('blur', this._onBlur);
|
||||||
|
@ -1636,10 +1633,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
document.removeEventListener('mousedown', this._onMouseDown);
|
document.removeEventListener('mousedown', this._onMouseDown);
|
||||||
document.removeEventListener('mouseover', this._onMouseOver);
|
document.removeEventListener('mouseover', this._onMouseOver);
|
||||||
|
|
||||||
if (this.isIe11) {
|
|
||||||
document.removeEventListener('focus', this._onDocumentFocus);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isSelectOneElement) {
|
if (this.isSelectOneElement) {
|
||||||
this.containerOuter.removeEventListener('focus', this._onFocus);
|
this.containerOuter.removeEventListener('focus', this._onFocus);
|
||||||
this.containerOuter.removeEventListener('blur', this._onBlur);
|
this.containerOuter.removeEventListener('blur', this._onBlur);
|
||||||
|
@ -1969,6 +1962,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
key: '_onMouseDown',
|
key: '_onMouseDown',
|
||||||
value: function _onMouseDown(e) {
|
value: function _onMouseDown(e) {
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
|
|
||||||
|
// If we have our mouse down on the scrollbar and are on IE11...
|
||||||
|
if (target === this.choiceList && this.isIe11) {
|
||||||
|
this.isScrollingOnIe = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.containerOuter.contains(target) && target !== this.input) {
|
if (this.containerOuter.contains(target) && target !== this.input) {
|
||||||
var foundTarget = void 0;
|
var foundTarget = void 0;
|
||||||
var activeItems = this.store.getItemsFilteredByActive();
|
var activeItems = this.store.getItemsFilteredByActive();
|
||||||
|
@ -2059,48 +2058,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Focus event on everything in the document
|
|
||||||
* @param {Object} e Event
|
|
||||||
* @return
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
|
|
||||||
}, {
|
|
||||||
key: '_onDocumentFocus',
|
|
||||||
value: function _onDocumentFocus(e) {
|
|
||||||
var _this17 = this;
|
|
||||||
|
|
||||||
var target = e.target;
|
|
||||||
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
|
|
||||||
|
|
||||||
var blurActions = {
|
|
||||||
text: function text() {
|
|
||||||
if (target !== _this17.input) {
|
|
||||||
if (hasActiveDropdown) {
|
|
||||||
_this17.hideDropdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'select-one': function selectOne() {
|
|
||||||
if (target !== _this17.containerOuter) {
|
|
||||||
if (hasActiveDropdown && !_this17.canSearch) {
|
|
||||||
_this17.hideDropdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'select-multiple': function selectMultiple() {
|
|
||||||
if (target !== _this17.input) {
|
|
||||||
if (hasActiveDropdown) {
|
|
||||||
_this17.hideDropdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
blurActions[this.passedElement.type]();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste event
|
* Paste event
|
||||||
* @param {Object} e Event
|
* @param {Object} e Event
|
||||||
|
@ -2127,7 +2084,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_onFocus',
|
key: '_onFocus',
|
||||||
value: function _onFocus(e) {
|
value: function _onFocus(e) {
|
||||||
var _this18 = this;
|
var _this17 = this;
|
||||||
|
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
// If target is something that concerns us
|
// If target is something that concerns us
|
||||||
|
@ -2135,27 +2092,27 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
|
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
|
||||||
var focusActions = {
|
var focusActions = {
|
||||||
text: function text() {
|
text: function text() {
|
||||||
if (target === _this18.input) {
|
if (target === _this17.input) {
|
||||||
_this18.containerOuter.classList.add(_this18.config.classNames.focusState);
|
_this17.containerOuter.classList.add(_this17.config.classNames.focusState);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'select-one': function selectOne() {
|
'select-one': function selectOne() {
|
||||||
_this18.containerOuter.classList.add(_this18.config.classNames.focusState);
|
_this17.containerOuter.classList.add(_this17.config.classNames.focusState);
|
||||||
if (target === _this18.input) {
|
if (target === _this17.input) {
|
||||||
// Show dropdown if it isn't already showing
|
// Show dropdown if it isn't already showing
|
||||||
if (!hasActiveDropdown) {
|
if (!hasActiveDropdown) {
|
||||||
_this18.showDropdown();
|
_this17.showDropdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'select-multiple': function selectMultiple() {
|
'select-multiple': function selectMultiple() {
|
||||||
if (target === _this18.input) {
|
if (target === _this17.input) {
|
||||||
// If element is a select box, the focused element is the container and the dropdown
|
// If element is a select box, the focused element is the container and the dropdown
|
||||||
// isn't already open, focus and show dropdown
|
// isn't already open, focus and show dropdown
|
||||||
_this18.containerOuter.classList.add(_this18.config.classNames.focusState);
|
_this17.containerOuter.classList.add(_this17.config.classNames.focusState);
|
||||||
|
|
||||||
if (!hasActiveDropdown) {
|
if (!hasActiveDropdown) {
|
||||||
_this18.showDropdown(true);
|
_this17.showDropdown(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2175,11 +2132,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_onBlur',
|
key: '_onBlur',
|
||||||
value: function _onBlur(e) {
|
value: function _onBlur(e) {
|
||||||
var _this19 = this;
|
var _this18 = this;
|
||||||
|
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
// If target is something that concerns us
|
// If target is something that concerns us
|
||||||
if (this.containerOuter.contains(target)) {
|
if (this.containerOuter.contains(target) && !this.isScrollingOnIe) {
|
||||||
var activeItems = this.store.getItemsFilteredByActive();
|
var activeItems = this.store.getItemsFilteredByActive();
|
||||||
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
|
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
|
||||||
var hasHighlightedItems = activeItems.some(function (item) {
|
var hasHighlightedItems = activeItems.some(function (item) {
|
||||||
|
@ -2187,49 +2144,55 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
});
|
});
|
||||||
var blurActions = {
|
var blurActions = {
|
||||||
text: function text() {
|
text: function text() {
|
||||||
if (target === _this19.input) {
|
if (target === _this18.input) {
|
||||||
// Remove the focus state
|
// Remove the focus state
|
||||||
_this19.containerOuter.classList.remove(_this19.config.classNames.focusState);
|
_this18.containerOuter.classList.remove(_this18.config.classNames.focusState);
|
||||||
// De-select any highlighted items
|
// De-select any highlighted items
|
||||||
if (hasHighlightedItems) {
|
if (hasHighlightedItems) {
|
||||||
_this19.unhighlightAll();
|
_this18.unhighlightAll();
|
||||||
}
|
}
|
||||||
// Hide dropdown if it is showing
|
// Hide dropdown if it is showing
|
||||||
if (hasActiveDropdown) {
|
if (hasActiveDropdown) {
|
||||||
_this19.hideDropdown();
|
_this18.hideDropdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'select-one': function selectOne() {
|
'select-one': function selectOne() {
|
||||||
_this19.containerOuter.classList.remove(_this19.config.classNames.focusState);
|
_this18.containerOuter.classList.remove(_this18.config.classNames.focusState);
|
||||||
if (target === _this19.containerOuter) {
|
if (target === _this18.containerOuter) {
|
||||||
// Hide dropdown if it is showing
|
// Hide dropdown if it is showing
|
||||||
if (hasActiveDropdown && !_this19.canSearch) {
|
if (hasActiveDropdown && !_this18.canSearch) {
|
||||||
_this19.hideDropdown();
|
_this18.hideDropdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target === _this19.input && hasActiveDropdown) {
|
if (target === _this18.input && hasActiveDropdown) {
|
||||||
// Hide dropdown if it is showing
|
// Hide dropdown if it is showing
|
||||||
_this19.hideDropdown();
|
_this18.hideDropdown();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'select-multiple': function selectMultiple() {
|
'select-multiple': function selectMultiple() {
|
||||||
if (target === _this19.input) {
|
if (target === _this18.input) {
|
||||||
// Remove the focus state
|
// Remove the focus state
|
||||||
_this19.containerOuter.classList.remove(_this19.config.classNames.focusState);
|
_this18.containerOuter.classList.remove(_this18.config.classNames.focusState);
|
||||||
// Hide dropdown if it is showing
|
// Hide dropdown if it is showing
|
||||||
if (hasActiveDropdown) {
|
if (hasActiveDropdown) {
|
||||||
_this19.hideDropdown();
|
_this18.hideDropdown();
|
||||||
}
|
}
|
||||||
// De-select any highlighted items
|
// De-select any highlighted items
|
||||||
if (hasHighlightedItems) {
|
if (hasHighlightedItems) {
|
||||||
_this19.unhighlightAll();
|
_this18.unhighlightAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
blurActions[this.passedElement.type]();
|
blurActions[this.passedElement.type]();
|
||||||
|
} else {
|
||||||
|
// On IE11, clicking the scollbar blurs our input and thus
|
||||||
|
// closes the dropdown. To stop this, we refocus our input
|
||||||
|
// if we know we are on IE *and* are scrolling.
|
||||||
|
this.isScrollingOnIe = false;
|
||||||
|
this.input.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2263,7 +2226,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_scrollToChoice',
|
key: '_scrollToChoice',
|
||||||
value: function _scrollToChoice(choice, direction) {
|
value: function _scrollToChoice(choice, direction) {
|
||||||
var _this20 = this;
|
var _this19 = this;
|
||||||
|
|
||||||
if (!choice) {
|
if (!choice) {
|
||||||
return;
|
return;
|
||||||
|
@ -2280,7 +2243,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
var animateScroll = function animateScroll() {
|
var animateScroll = function animateScroll() {
|
||||||
var strength = 4;
|
var strength = 4;
|
||||||
var choiceListScrollTop = _this20.choiceList.scrollTop;
|
var choiceListScrollTop = _this19.choiceList.scrollTop;
|
||||||
var continueAnimation = false;
|
var continueAnimation = false;
|
||||||
var easing = void 0;
|
var easing = void 0;
|
||||||
var distance = void 0;
|
var distance = void 0;
|
||||||
|
@ -2289,7 +2252,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
easing = (endPoint - choiceListScrollTop) / strength;
|
easing = (endPoint - choiceListScrollTop) / strength;
|
||||||
distance = easing > 1 ? easing : 1;
|
distance = easing > 1 ? easing : 1;
|
||||||
|
|
||||||
_this20.choiceList.scrollTop = choiceListScrollTop + distance;
|
_this19.choiceList.scrollTop = choiceListScrollTop + distance;
|
||||||
if (choiceListScrollTop < endPoint) {
|
if (choiceListScrollTop < endPoint) {
|
||||||
continueAnimation = true;
|
continueAnimation = true;
|
||||||
}
|
}
|
||||||
|
@ -2297,7 +2260,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
easing = (choiceListScrollTop - endPoint) / strength;
|
easing = (choiceListScrollTop - endPoint) / strength;
|
||||||
distance = easing > 1 ? easing : 1;
|
distance = easing > 1 ? easing : 1;
|
||||||
|
|
||||||
_this20.choiceList.scrollTop = choiceListScrollTop - distance;
|
_this19.choiceList.scrollTop = choiceListScrollTop - distance;
|
||||||
if (choiceListScrollTop > endPoint) {
|
if (choiceListScrollTop > endPoint) {
|
||||||
continueAnimation = true;
|
continueAnimation = true;
|
||||||
}
|
}
|
||||||
|
@ -2325,7 +2288,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_highlightChoice',
|
key: '_highlightChoice',
|
||||||
value: function _highlightChoice() {
|
value: function _highlightChoice() {
|
||||||
var _this21 = this;
|
var _this20 = this;
|
||||||
|
|
||||||
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
||||||
|
|
||||||
|
@ -2338,7 +2301,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
// Remove any highlighted choices
|
// Remove any highlighted choices
|
||||||
highlightedChoices.forEach(function (choice) {
|
highlightedChoices.forEach(function (choice) {
|
||||||
choice.classList.remove(_this21.config.classNames.highlightedState);
|
choice.classList.remove(_this20.config.classNames.highlightedState);
|
||||||
choice.setAttribute('aria-selected', 'false');
|
choice.setAttribute('aria-selected', 'false');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2541,7 +2504,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_addGroup',
|
key: '_addGroup',
|
||||||
value: function _addGroup(group, id) {
|
value: function _addGroup(group, id) {
|
||||||
var _this22 = this;
|
var _this21 = this;
|
||||||
|
|
||||||
var valueKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
|
var valueKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
|
||||||
var labelKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
|
var labelKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
|
||||||
|
@ -2557,7 +2520,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var isOptDisabled = option.disabled || option.parentNode && option.parentNode.disabled;
|
var isOptDisabled = option.disabled || option.parentNode && option.parentNode.disabled;
|
||||||
var label = (0, _utils.isType)('Object', option) ? option[labelKey] : option.innerHTML;
|
var label = (0, _utils.isType)('Object', option) ? option[labelKey] : option.innerHTML;
|
||||||
|
|
||||||
_this22._addChoice(option[valueKey], label, option.selected, isOptDisabled, groupId, option.customProperties);
|
_this21._addChoice(option[valueKey], label, option.selected, isOptDisabled, groupId, option.customProperties);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.store.dispatch((0, _index3.addGroup)(group.label, group.id, false, group.disabled));
|
this.store.dispatch((0, _index3.addGroup)(group.label, group.id, false, group.disabled));
|
||||||
|
@ -2596,12 +2559,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_createTemplates',
|
key: '_createTemplates',
|
||||||
value: function _createTemplates() {
|
value: function _createTemplates() {
|
||||||
var _this23 = this;
|
var _this22 = this;
|
||||||
|
|
||||||
var globalClasses = this.config.classNames;
|
var globalClasses = this.config.classNames;
|
||||||
var templates = {
|
var templates = {
|
||||||
containerOuter: function containerOuter(direction) {
|
containerOuter: function containerOuter(direction) {
|
||||||
return (0, _utils.strToEl)('\n <div\n class="' + globalClasses.containerOuter + '"\n ' + (_this23.isSelectElement ? _this23.config.searchEnabled ? 'role="combobox" aria-autocomplete="list"' : 'role="listbox"' : '') + '\n data-type="' + _this23.passedElement.type + '"\n ' + (_this23.isSelectOneElement ? 'tabindex="0"' : '') + '\n aria-haspopup="true"\n aria-expanded="false"\n dir="' + direction + '"\n >\n </div>\n ');
|
return (0, _utils.strToEl)('\n <div\n class="' + globalClasses.containerOuter + '"\n ' + (_this22.isSelectElement ? _this22.config.searchEnabled ? 'role="combobox" aria-autocomplete="list"' : 'role="listbox"' : '') + '\n data-type="' + _this22.passedElement.type + '"\n ' + (_this22.isSelectOneElement ? 'tabindex="0"' : '') + '\n aria-haspopup="true"\n aria-expanded="false"\n dir="' + direction + '"\n >\n </div>\n ');
|
||||||
},
|
},
|
||||||
containerInner: function containerInner() {
|
containerInner: function containerInner() {
|
||||||
return (0, _utils.strToEl)('\n <div class="' + globalClasses.containerInner + '"></div>\n ');
|
return (0, _utils.strToEl)('\n <div class="' + globalClasses.containerInner + '"></div>\n ');
|
||||||
|
@ -2609,7 +2572,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
itemList: function itemList() {
|
itemList: function itemList() {
|
||||||
var _classNames;
|
var _classNames;
|
||||||
|
|
||||||
var localClasses = (0, _classnames2.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, _this23.isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !_this23.isSelectOneElement), _classNames));
|
var localClasses = (0, _classnames2.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, _this22.isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !_this22.isSelectOneElement), _classNames));
|
||||||
|
|
||||||
return (0, _utils.strToEl)('\n <div class="' + localClasses + '"></div>\n ');
|
return (0, _utils.strToEl)('\n <div class="' + localClasses + '"></div>\n ');
|
||||||
},
|
},
|
||||||
|
@ -2621,7 +2584,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
var localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _classNames2));
|
var localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _classNames2));
|
||||||
|
|
||||||
if (_this23.config.removeItemButton) {
|
if (_this22.config.removeItemButton) {
|
||||||
var _classNames3;
|
var _classNames3;
|
||||||
|
|
||||||
localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _classNames3));
|
localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _classNames3));
|
||||||
|
@ -2632,7 +2595,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-item\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n ' + (data.active ? 'aria-selected="true"' : '') + '\n ' + (data.disabled ? 'aria-disabled="true"' : '') + '\n >\n ' + data.label + '\n </div>\n ');
|
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-item\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n ' + (data.active ? 'aria-selected="true"' : '') + '\n ' + (data.disabled ? 'aria-disabled="true"' : '') + '\n >\n ' + data.label + '\n </div>\n ');
|
||||||
},
|
},
|
||||||
choiceList: function choiceList() {
|
choiceList: function choiceList() {
|
||||||
return (0, _utils.strToEl)('\n <div\n class="' + globalClasses.list + '"\n dir="ltr"\n role="listbox"\n ' + (!_this23.isSelectOneElement ? 'aria-multiselectable="true"' : '') + '\n >\n </div>\n ');
|
return (0, _utils.strToEl)('\n <div\n class="' + globalClasses.list + '"\n dir="ltr"\n role="listbox"\n ' + (!_this22.isSelectOneElement ? 'aria-multiselectable="true"' : '') + '\n >\n </div>\n ');
|
||||||
},
|
},
|
||||||
choiceGroup: function choiceGroup(data) {
|
choiceGroup: function choiceGroup(data) {
|
||||||
var localClasses = (0, _classnames2.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
|
var localClasses = (0, _classnames2.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
|
||||||
|
@ -2644,7 +2607,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _classNames5));
|
var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _classNames5));
|
||||||
|
|
||||||
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-select-text="' + _this23.config.itemSelectText + '"\n data-choice\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n ' + (data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable') + '\n id="' + data.elementId + '"\n ' + (data.groupId > 0 ? 'role="treeitem"' : 'role="option"') + '\n >\n ' + data.label + '\n </div>\n ');
|
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-select-text="' + _this22.config.itemSelectText + '"\n data-choice\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n ' + (data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable') + '\n id="' + data.elementId + '"\n ' + (data.groupId > 0 ? 'role="treeitem"' : 'role="option"') + '\n >\n ' + data.label + '\n </div>\n ');
|
||||||
},
|
},
|
||||||
input: function input() {
|
input: function input() {
|
||||||
var localClasses = (0, _classnames2.default)(globalClasses.input, globalClasses.inputCloned);
|
var localClasses = (0, _classnames2.default)(globalClasses.input, globalClasses.inputCloned);
|
||||||
|
@ -2685,7 +2648,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}, {
|
}, {
|
||||||
key: '_createInput',
|
key: '_createInput',
|
||||||
value: function _createInput() {
|
value: function _createInput() {
|
||||||
var _this24 = this;
|
var _this23 = this;
|
||||||
|
|
||||||
var direction = this.passedElement.getAttribute('dir') || 'ltr';
|
var direction = this.passedElement.getAttribute('dir') || 'ltr';
|
||||||
var containerOuter = this._getTemplate('containerOuter', direction);
|
var containerOuter = this._getTemplate('containerOuter', direction);
|
||||||
|
@ -2760,7 +2723,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
if (passedGroups && passedGroups.length) {
|
if (passedGroups && passedGroups.length) {
|
||||||
passedGroups.forEach(function (group) {
|
passedGroups.forEach(function (group) {
|
||||||
_this24._addGroup(group, group.id || null);
|
_this23._addGroup(group, group.id || null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var passedOptions = Array.from(this.passedElement.options);
|
var passedOptions = Array.from(this.passedElement.options);
|
||||||
|
@ -2790,17 +2753,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
// Add each choice
|
// Add each choice
|
||||||
allChoices.forEach(function (choice, index) {
|
allChoices.forEach(function (choice, index) {
|
||||||
// Pre-select first choice if it's a single select
|
// Pre-select first choice if it's a single select
|
||||||
if (_this24.isSelectOneElement) {
|
if (_this23.isSelectOneElement) {
|
||||||
if (hasSelectedChoice || !hasSelectedChoice && index > 0) {
|
if (hasSelectedChoice || !hasSelectedChoice && index > 0) {
|
||||||
// If there is a selected choice already or the choice is not
|
// If there is a selected choice already or the choice is not
|
||||||
// the first in the array, add each choice normally
|
// the first in the array, add each choice normally
|
||||||
_this24._addChoice(choice.value, choice.label, choice.selected, choice.disabled, undefined, choice.customProperties);
|
_this23._addChoice(choice.value, choice.label, choice.selected, choice.disabled, undefined, choice.customProperties);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise pre-select the first choice in the array
|
// Otherwise pre-select the first choice in the array
|
||||||
_this24._addChoice(choice.value, choice.label, true, false, undefined, choice.customProperties);
|
_this23._addChoice(choice.value, choice.label, true, false, undefined, choice.customProperties);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_this24._addChoice(choice.value, choice.label, choice.selected, choice.disabled, undefined, choice.customProperties);
|
_this23._addChoice(choice.value, choice.label, choice.selected, choice.disabled, undefined, choice.customProperties);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2812,9 +2775,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
if (!item.value) {
|
if (!item.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_this24._addItem(item.value, item.label, item.id, undefined, item.customProperties);
|
_this23._addItem(item.value, item.label, item.id, undefined, item.customProperties);
|
||||||
} else if (itemType === 'String') {
|
} else if (itemType === 'String') {
|
||||||
_this24._addItem(item);
|
_this23._addItem(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
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.11",
|
"version": "2.8.12",
|
||||||
"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.11">
|
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.8.12">
|
||||||
<!-- 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.11">
|
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.8.12">
|
||||||
<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.11",
|
"version": "2.8.12",
|
||||||
"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.11 run version
|
// Example usage: npm --newVersion=2.8.12 run version
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
Loading…
Reference in a new issue