Update dist files, after FF from main repo

This commit is contained in:
Stéphane Trébel 2016-12-05 14:52:51 +01:00 committed by Josh Johnson
parent 4cb04613e3
commit 940f695a1c
3 changed files with 68 additions and 40 deletions

View file

@ -184,18 +184,6 @@ return /******/ (function(modules) { // webpackBootstrap
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)
this.element = element;
this.passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element;
@ -207,8 +195,14 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}
this.highlightPosition = 0;
this.canSearch = this.config.search;
// It only makes sense for addItems to be true for
// 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
this.presetChoices = this.config.choices;
@ -240,7 +234,16 @@ return /******/ (function(modules) { // webpackBootstrap
this._onPaste = this._onPaste.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;
// Cutting the mustard
@ -522,7 +525,7 @@ return /******/ (function(modules) { // webpackBootstrap
var canAddItem = this._canAddItem(activeItems, this.input.value);
var dropdownItem = this._getTemplate('notice', this.config.noChoicesText);
if (canAddItem.notice) {
if (this.config.addItems && canAddItem.notice) {
dropdownItem = this._getTemplate('notice', canAddItem.notice);
} else if (this.isSearching) {
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._triggerChange(choice.value);
this._triggerChange(choice.value);
this.clearInput(this.passedElement);
// 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 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) {
var isUnique = !activeItems.some(function (item) {
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 (this.config.regexFilter) {
// Determine whether we can update based on whether
@ -1619,14 +1622,11 @@ return /******/ (function(modules) { // webpackBootstrap
};
var onEnterKey = function onEnterKey() {
var highlighted = _this17.dropdown.querySelector('.' + _this17.config.classNames.highlightedState);
if (hasActiveDropdown) {
var highlighted = _this17.dropdown.querySelector('.' + _this17.config.classNames.highlightedState);
// If we have a highlighted choice
if (highlighted) {
_this17._handleChoiceAction(activeItems, highlighted);
}
if (hasActiveDropdown && highlighted) {
// If we have a highlighted choice, select it
_this17._handleChoiceAction(activeItems, highlighted);
} else if (passedElementType === 'select-one') {
// Open single select dropdown if it's not active
if (!hasActiveDropdown) {
@ -1648,6 +1648,7 @@ return /******/ (function(modules) { // webpackBootstrap
// All is good, add
if (canAddItem.response) {
<<<<<<< HEAD
if (hasActiveDropdown) {
_this16.hideDropdown();
}
@ -1656,17 +1657,32 @@ return /******/ (function(modules) { // webpackBootstrap
_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
if (_this17.isTextElement) {
_this17._addItem(value);
} else {
_this17._addChoice(true, false, value, value);
console.log(_this17.store.getState());
}
if (willAddItem) {
if (hasActiveDropdown) {
_this17.hideDropdown();
}
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.clearInput(_this17.passedElement);
>>>>>>> 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(dropdown);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long