mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-15 20:25:18 +02:00
Version 2.7.7
This commit is contained in:
parent
7efd189c7d
commit
7255fa42ce
49
assets/scripts/dist/choices.js
vendored
49
assets/scripts/dist/choices.js
vendored
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v2.7.6 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v2.7.7 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
|
@ -754,6 +754,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
this.containerOuter.classList.add(this.config.classNames.openState);
|
||||
this.containerOuter.setAttribute('aria-expanded', 'true');
|
||||
this.dropdown.classList.add(this.config.classNames.activeState);
|
||||
this.dropdown.setAttribute('aria-expanded', 'true');
|
||||
|
||||
var dimensions = this.dropdown.getBoundingClientRect();
|
||||
var dropdownPos = Math.ceil(dimensions.top + window.scrollY + dimensions.height);
|
||||
|
@ -799,6 +800,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
this.containerOuter.classList.remove(this.config.classNames.openState);
|
||||
this.containerOuter.setAttribute('aria-expanded', 'false');
|
||||
this.dropdown.classList.remove(this.config.classNames.activeState);
|
||||
this.dropdown.setAttribute('aria-expanded', 'false');
|
||||
|
||||
if (isFlipped) {
|
||||
this.containerOuter.classList.remove(this.config.classNames.flippedState);
|
||||
|
@ -1204,6 +1206,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var choice = this.store.getChoiceById(id);
|
||||
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
|
||||
|
||||
(0, _utils.triggerEvent)(this.passedElement, 'choice', {
|
||||
choice: choice
|
||||
});
|
||||
|
||||
if (choice && !choice.selected && !choice.disabled) {
|
||||
var canAddItem = this._canAddItem(activeItems, choice.value);
|
||||
|
||||
|
@ -1809,13 +1815,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
value: function _onMouseDown(e) {
|
||||
var target = e.target;
|
||||
if (this.containerOuter.contains(target) && target !== this.input) {
|
||||
var foundTarget = void 0;
|
||||
var activeItems = this.store.getItemsFilteredByActive();
|
||||
var hasShiftKey = e.shiftKey;
|
||||
var foundTarget = void 0;
|
||||
|
||||
if (foundTarget = (0, _utils.findAncestorByAttr)(target, 'data-item')) {
|
||||
if (foundTarget = (0, _utils.findAncestorByAttrName)(target, 'data-button')) {
|
||||
this._handleButtonAction(activeItems, foundTarget);
|
||||
} else if (foundTarget = (0, _utils.findAncestorByAttrName)(target, 'data-item')) {
|
||||
this._handleItemAction(activeItems, foundTarget, hasShiftKey);
|
||||
} else if (foundTarget = (0, _utils.findAncestorByAttr)(target, 'data-choice')) {
|
||||
} else if (foundTarget = (0, _utils.findAncestorByAttrName)(target, 'data-choice')) {
|
||||
this._handleChoiceAction(activeItems, foundTarget);
|
||||
}
|
||||
|
||||
|
@ -2377,43 +2385,43 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var classNames = this.config.classNames;
|
||||
var templates = {
|
||||
containerOuter: function containerOuter(direction) {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.containerOuter + '" data-type="' + _this22.passedElement.type + '" ' + (_this22.passedElement.type === 'select-one' ? 'tabindex="0"' : '') + ' aria-haspopup="true" aria-expanded="false" dir="' + direction + '"></div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.containerOuter + '" data-type="' + _this22.passedElement.type + '" ' + (_this22.passedElement.type === 'select-one' ? 'tabindex="0"' : '') + ' aria-haspopup="true" aria-expanded="false" dir="' + direction + '"></div>\n ');
|
||||
},
|
||||
containerInner: function containerInner() {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.containerInner + '"></div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.containerInner + '"></div>\n ');
|
||||
},
|
||||
itemList: function itemList() {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.list + ' ' + (_this22.passedElement.type === 'select-one' ? classNames.listSingle : classNames.listItems) + '"></div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.list + ' ' + (_this22.passedElement.type === 'select-one' ? classNames.listSingle : classNames.listItems) + '"></div>\n ');
|
||||
},
|
||||
placeholder: function placeholder(value) {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.placeholder + '">' + value + '</div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.placeholder + '">' + value + '</div>\n ');
|
||||
},
|
||||
item: function item(data) {
|
||||
if (_this22.config.removeItemButton) {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + (data.highlighted ? classNames.highlightedState : '') + ' ' + (!data.disabled ? classNames.itemSelectable : '') + '" data-item data-id="' + data.id + '" data-value="' + data.value + '" ' + (data.active ? 'aria-selected="true"' : '') + ' ' + (data.disabled ? 'aria-disabled="true"' : '') + ' data-deletable>\n ' + data.label + '<button type="button" class="' + classNames.button + '" data-button>Remove item</button>\n </div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + (data.highlighted ? classNames.highlightedState : '') + ' ' + (!data.disabled ? classNames.itemSelectable : '') + '" data-item data-id="' + data.id + '" data-value="' + data.value + '" ' + (data.active ? 'aria-selected="true"' : '') + ' ' + (data.disabled ? 'aria-disabled="true"' : '') + ' data-deletable>\n ' + data.label + '<button type="button" class="' + classNames.button + '" data-button>Remove item</button>\n </div>\n ');
|
||||
}
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + (data.highlighted ? classNames.highlightedState : classNames.itemSelectable) + '" data-item data-id="' + data.id + '" data-value="' + data.value + '" ' + (data.active ? 'aria-selected="true"' : '') + ' ' + (data.disabled ? 'aria-disabled="true"' : '') + '>\n ' + data.label + '\n </div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + (data.highlighted ? classNames.highlightedState : classNames.itemSelectable) + '" data-item data-id="' + data.id + '" data-value="' + data.value + '" ' + (data.active ? 'aria-selected="true"' : '') + ' ' + (data.disabled ? 'aria-disabled="true"' : '') + '>\n ' + data.label + '\n </div>\n ');
|
||||
},
|
||||
choiceList: function choiceList() {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.list + '" dir="ltr" role="listbox" ' + (_this22.passedElement.type !== 'select-one' ? 'aria-multiselectable="true"' : '') + '></div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.list + '" dir="ltr" role="listbox" ' + (_this22.passedElement.type !== 'select-one' ? 'aria-multiselectable="true"' : '') + '></div>\n ');
|
||||
},
|
||||
choiceGroup: function choiceGroup(data) {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.group + ' ' + (data.disabled ? classNames.itemDisabled : '') + '" data-group data-id="' + data.id + '" data-value="' + data.value + '" role="group" ' + (data.disabled ? 'aria-disabled="true"' : '') + '>\n <div class="' + classNames.groupHeading + '">' + data.value + '</div>\n </div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.group + ' ' + (data.disabled ? classNames.itemDisabled : '') + '" data-group data-id="' + data.id + '" data-value="' + data.value + '" role="group" ' + (data.disabled ? 'aria-disabled="true"' : '') + '>\n <div class="' + classNames.groupHeading + '">' + data.value + '</div>\n </div>\n ');
|
||||
},
|
||||
choice: function choice(data) {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + classNames.itemChoice + ' ' + (data.disabled ? classNames.itemDisabled : classNames.itemSelectable) + '" data-select-text="' + _this22.config.itemSelectText + '" data-choice ' + (data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable') + ' data-id="' + data.id + '" data-value="' + data.value + '" ' + (data.groupId > 0 ? 'role="treeitem"' : 'role="option"') + '>\n ' + data.label + '\n </div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + classNames.itemChoice + ' ' + (data.disabled ? classNames.itemDisabled : classNames.itemSelectable) + '" data-select-text="' + _this22.config.itemSelectText + '" data-choice ' + (data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable') + ' data-id="' + data.id + '" data-value="' + data.value + '" ' + (data.groupId > 0 ? 'role="treeitem"' : 'role="option"') + '>\n ' + data.label + '\n </div>\n ');
|
||||
},
|
||||
input: function input() {
|
||||
return (0, _utils.strToEl)('\n <input type="text" class="' + classNames.input + ' ' + classNames.inputCloned + '" autocomplete="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list">\n ');
|
||||
return (0, _utils.strToEl)('\n <input type="text" class="' + classNames.input + ' ' + classNames.inputCloned + '" autocomplete="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list">\n ');
|
||||
},
|
||||
dropdown: function dropdown() {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.list + ' ' + classNames.listDropdown + '" aria-expanded="false"></div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.list + ' ' + classNames.listDropdown + '" aria-expanded="false"></div>\n ');
|
||||
},
|
||||
notice: function notice(label) {
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + classNames.itemChoice + '">' + label + '</div>\n ');
|
||||
return (0, _utils.strToEl)('\n <div class="' + classNames.item + ' ' + classNames.itemChoice + '">' + label + '</div>\n ');
|
||||
},
|
||||
option: function option(data) {
|
||||
return (0, _utils.strToEl)('\n <option value="' + data.value + '" selected>' + data.label + '</option>\n ');
|
||||
return (0, _utils.strToEl)('\n <option value="' + data.value + '" selected>' + data.label + '</option>\n ');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2671,7 +2679,10 @@ 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 || {}
|
||||
|
@ -2690,7 +2701,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
}
|
||||
|
||||
Fuse.VERSION = '2.6.2'
|
||||
Fuse.VERSION = '2.6.0'
|
||||
|
||||
/**
|
||||
* Sets a new list for Fuse to match against.
|
||||
|
@ -5294,7 +5305,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
* @param {string} attr Attribute name of parent
|
||||
* @return {?NodeElement} Found parent element or null
|
||||
*/
|
||||
var findAncestorByAttr = exports.findAncestorByAttr = function findAncestorByAttr(el, attr) {
|
||||
var findAncestorByAttrName = exports.findAncestorByAttrName = function findAncestorByAttrName(el, attr) {
|
||||
var target = el;
|
||||
|
||||
while (target) {
|
||||
|
|
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
6
assets/scripts/dist/choices.min.js
vendored
6
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",
|
||||
"version": "2.7.6",
|
||||
"version": "2.7.7",
|
||||
"description": "A vanilla JS customisable text input/select box plugin",
|
||||
"main": [
|
||||
"./assets/scripts/dist/choices.js",
|
||||
|
|
|
@ -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.6">
|
||||
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=2.7.7">
|
||||
<!-- 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.6">
|
||||
<script src="assets/scripts/dist/choices.min.js?version=2.7.6"></script>
|
||||
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=2.7.7">
|
||||
<script src="assets/scripts/dist/choices.min.js?version=2.7.7"></script>
|
||||
<!-- End Choices includes -->
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "choices.js",
|
||||
"version": "2.7.6",
|
||||
"version": "2.7.7",
|
||||
"description": "A vanilla JS customisable text input/select box plugin",
|
||||
"main": "./assets/scripts/dist/choices.min.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue