mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-19 22:25:09 +02:00
Update dist files, after FF from main repo
This commit is contained in:
parent
4cb04613e3
commit
940f695a1c
99
assets/scripts/dist/choices.js
vendored
99
assets/scripts/dist/choices.js
vendored
|
@ -184,18 +184,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
callbackOnCreateTemplates: null
|
callbackOnCreateTemplates: null
|
||||||
};
|
};
|
||||||
|
|
||||||
// Merge options with user options
|
|
||||||
this.config = (0, _utils.extend)(defaultConfig, userConfig);
|
|
||||||
|
|
||||||
// Create data store
|
|
||||||
this.store = new _index2.default(this.render);
|
|
||||||
|
|
||||||
// State tracking
|
|
||||||
this.initialised = false;
|
|
||||||
this.currentState = {};
|
|
||||||
this.prevState = {};
|
|
||||||
this.currentValue = '';
|
|
||||||
|
|
||||||
// Retrieve triggering element (i.e. element with 'data-choice' trigger)
|
// Retrieve triggering element (i.e. element with 'data-choice' trigger)
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element;
|
this.passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element;
|
||||||
|
@ -207,8 +195,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.highlightPosition = 0;
|
// It only makes sense for addItems to be true for
|
||||||
this.canSearch = this.config.search;
|
// text inputs by default
|
||||||
|
if (this.isSelectElement) {
|
||||||
|
defaultConfig.addItems = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge options with user options
|
||||||
|
this.config = (0, _utils.extend)(defaultConfig, userConfig);
|
||||||
|
|
||||||
// Assing preset choices from passed object
|
// Assing preset choices from passed object
|
||||||
this.presetChoices = this.config.choices;
|
this.presetChoices = this.config.choices;
|
||||||
|
@ -240,7 +234,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this._onPaste = this._onPaste.bind(this);
|
this._onPaste = this._onPaste.bind(this);
|
||||||
this._onInput = this._onInput.bind(this);
|
this._onInput = this._onInput.bind(this);
|
||||||
|
|
||||||
// Monitor touch taps/scrolls
|
// Create data store
|
||||||
|
this.store = new _index2.default(this.render);
|
||||||
|
|
||||||
|
// State tracking
|
||||||
|
this.initialised = false;
|
||||||
|
this.currentState = {};
|
||||||
|
this.prevState = {};
|
||||||
|
this.currentValue = '';
|
||||||
|
this.highlightPosition = 0;
|
||||||
|
this.canSearch = this.config.search;
|
||||||
this.wasTap = true;
|
this.wasTap = true;
|
||||||
|
|
||||||
// Cutting the mustard
|
// Cutting the mustard
|
||||||
|
@ -522,7 +525,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var canAddItem = this._canAddItem(activeItems, this.input.value);
|
var canAddItem = this._canAddItem(activeItems, this.input.value);
|
||||||
var dropdownItem = this._getTemplate('notice', this.config.noChoicesText);
|
var dropdownItem = this._getTemplate('notice', this.config.noChoicesText);
|
||||||
|
|
||||||
if (canAddItem.notice) {
|
if (this.config.addItems && canAddItem.notice) {
|
||||||
dropdownItem = this._getTemplate('notice', canAddItem.notice);
|
dropdownItem = this._getTemplate('notice', canAddItem.notice);
|
||||||
} else if (this.isSearching) {
|
} else if (this.isSearching) {
|
||||||
dropdownItem = this._getTemplate('notice', this.config.noResultsText);
|
dropdownItem = this._getTemplate('notice', this.config.noResultsText);
|
||||||
|
@ -1238,8 +1241,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
this._addItem(choice.value, choice.label, choice.id, choice.groupId);
|
this._addItem(choice.value, choice.label, choice.id, choice.groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._triggerChange(choice.value);
|
|
||||||
|
|
||||||
|
this._triggerChange(choice.value);
|
||||||
this.clearInput(this.passedElement);
|
this.clearInput(this.passedElement);
|
||||||
|
|
||||||
// We wont to close the dropdown if we are dealing with a single select box
|
// We wont to close the dropdown if we are dealing with a single select box
|
||||||
|
@ -1295,20 +1298,20 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
var canAddItem = true;
|
var canAddItem = true;
|
||||||
var notice = (0, _utils.isType)('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText;
|
var notice = (0, _utils.isType)('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText;
|
||||||
|
|
||||||
if (this.passedElement.type === 'select-multiple' || this.passedElement.type === 'text') {
|
|
||||||
if (this.config.maxItemCount > 0 && this.config.maxItemCount <= this.itemList.children.length) {
|
|
||||||
// If there is a max entry limit and we have reached that limit
|
|
||||||
// don't update
|
|
||||||
canAddItem = false;
|
|
||||||
notice = (0, _utils.isType)('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.config.addItems) {
|
if (this.config.addItems) {
|
||||||
var isUnique = !activeItems.some(function (item) {
|
var isUnique = !activeItems.some(function (item) {
|
||||||
return item.value === value.trim();
|
return item.value === value.trim();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.passedElement.type === 'select-multiple' || this.passedElement.type === 'text') {
|
||||||
|
if (this.config.maxItemCount > 0 && this.config.maxItemCount <= this.itemList.children.length) {
|
||||||
|
// If there is a max entry limit and we have reached that limit
|
||||||
|
// don't update
|
||||||
|
canAddItem = false;
|
||||||
|
notice = (0, _utils.isType)('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a user has supplied a regular expression filter
|
// If a user has supplied a regular expression filter
|
||||||
if (this.config.regexFilter) {
|
if (this.config.regexFilter) {
|
||||||
// Determine whether we can update based on whether
|
// Determine whether we can update based on whether
|
||||||
|
@ -1619,14 +1622,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
};
|
};
|
||||||
|
|
||||||
var onEnterKey = function onEnterKey() {
|
var onEnterKey = function onEnterKey() {
|
||||||
|
var highlighted = _this17.dropdown.querySelector('.' + _this17.config.classNames.highlightedState);
|
||||||
|
|
||||||
if (hasActiveDropdown) {
|
if (hasActiveDropdown && highlighted) {
|
||||||
var highlighted = _this17.dropdown.querySelector('.' + _this17.config.classNames.highlightedState);
|
// If we have a highlighted choice, select it
|
||||||
|
_this17._handleChoiceAction(activeItems, highlighted);
|
||||||
// If we have a highlighted choice
|
|
||||||
if (highlighted) {
|
|
||||||
_this17._handleChoiceAction(activeItems, highlighted);
|
|
||||||
}
|
|
||||||
} else if (passedElementType === 'select-one') {
|
} else if (passedElementType === 'select-one') {
|
||||||
// Open single select dropdown if it's not active
|
// Open single select dropdown if it's not active
|
||||||
if (!hasActiveDropdown) {
|
if (!hasActiveDropdown) {
|
||||||
|
@ -1648,6 +1648,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
// All is good, add
|
// All is good, add
|
||||||
if (canAddItem.response) {
|
if (canAddItem.response) {
|
||||||
|
<<<<<<< HEAD
|
||||||
if (hasActiveDropdown) {
|
if (hasActiveDropdown) {
|
||||||
_this16.hideDropdown();
|
_this16.hideDropdown();
|
||||||
}
|
}
|
||||||
|
@ -1656,17 +1657,32 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
_this16._triggerChange(value);
|
_this16._triggerChange(value);
|
||||||
_this16.clearInput(_this16.passedElement);
|
_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
|
||||||
|
|
||||||
if (_this17.isTextElement) {
|
if (willAddItem) {
|
||||||
_this17._addItem(value);
|
if (hasActiveDropdown) {
|
||||||
} else {
|
_this17.hideDropdown();
|
||||||
_this17._addChoice(true, false, value, value);
|
}
|
||||||
console.log(_this17.store.getState());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (_this17.isTextElement) {
|
||||||
|
_this17._addItem(value);
|
||||||
|
} else if (_this17.config.addItems) {
|
||||||
|
_this17._addChoice(true, false, value, value);
|
||||||
|
_this17.containerOuter.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
_this17._triggerChange(value);
|
_this17._triggerChange(value);
|
||||||
_this17.clearInput(_this17.passedElement);
|
_this17.clearInput(_this17.passedElement);
|
||||||
>>>>>>> 291143b... Add dist files
|
>>>>>>> 291143b... Add dist files
|
||||||
|
=======
|
||||||
|
_this17._triggerChange(value);
|
||||||
|
_this17.clearInput(_this17.passedElement);
|
||||||
|
}
|
||||||
|
>>>>>>> acb2451... Update dist files, after FF from main repo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2562,7 +2578,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.config.addItems) this.disable();
|
// Disable text input if no entry allowed
|
||||||
|
if (!this.config.addItems && this.isTextElement) {
|
||||||
|
this.disable();
|
||||||
|
}
|
||||||
|
|
||||||
containerOuter.appendChild(containerInner);
|
containerOuter.appendChild(containerInner);
|
||||||
containerOuter.appendChild(dropdown);
|
containerOuter.appendChild(dropdown);
|
||||||
|
|
4
assets/scripts/dist/choices.js.map
vendored
4
assets/scripts/dist/choices.js.map
vendored
File diff suppressed because one or more lines are too long
5
assets/scripts/dist/choices.min.js
vendored
5
assets/scripts/dist/choices.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue