vue-simple-suggest
Advanced tools
Comparing version 1.8.3 to 1.9.0
214
dist/cjs.js
@@ -65,4 +65,3 @@ 'use strict'; | ||
} | ||
} | ||
function _await(value, then, direct) { | ||
}function _await(value, then, direct) { | ||
if (direct) { | ||
@@ -103,4 +102,2 @@ return then ? then(value) : value; | ||
}function _empty() {} | ||
var event = 'input'; | ||
var VueSimpleSuggest = { | ||
@@ -112,29 +109,26 @@ render: function render() { | ||
}_vm.isTabbed = true; | ||
} } }, [_c('div', { ref: "inputSlot", staticClass: "input-wrapper", class: _vm.styles.inputWrapper }, [_vm._t("default", [_c('input', _vm._b({ staticClass: "default-input", class: _vm.styles.defaultInput, domProps: { "value": _vm.text || '' } }, 'input', _vm.$attrs, false))])], 2), _vm._v(" "), _c('transition', { attrs: { "name": "vue-simple-suggest" } }, [!!_vm.listShown && !_vm.removeList ? _c('div', { staticClass: "suggestions", class: _vm.styles.suggestions, on: { "mouseenter": function mouseenter($event) { | ||
} } }, [_c('div', { ref: "inputSlot", staticClass: "input-wrapper", class: _vm.styles.inputWrapper, attrs: { "role": "combobox", "aria-haspopup": "listbox", "aria-owns": _vm.listId, "aria-expanded": !!_vm.listShown && !_vm.removeList ? 'true' : 'false' } }, [_vm._t("default", [_c('input', _vm._b({ staticClass: "default-input", class: _vm.styles.defaultInput, domProps: { "value": _vm.text || '' } }, 'input', _vm.$attrs, false))])], 2), _vm._v(" "), _c('transition', { attrs: { "name": "vue-simple-suggest" } }, [!!_vm.listShown && !_vm.removeList ? _c('ul', { staticClass: "suggestions", class: _vm.styles.suggestions, attrs: { "id": _vm.listId, "role": "listbox", "aria-labelledby": _vm.listId }, on: { "mouseenter": function mouseenter($event) { | ||
_vm.hoverList(true); | ||
}, "mouseleave": function mouseleave($event) { | ||
_vm.hoverList(false); | ||
} } }, [_vm._t("misc-item-above", null, { suggestions: _vm.suggestions, query: _vm.text }), _vm._v(" "), _vm._l(_vm.suggestions, function (suggestion, index) { | ||
return _c('div', { key: _vm.isPlainSuggestion ? 'suggestion-' + index : _vm.valueProperty(suggestion), staticClass: "suggest-item", class: [_vm.styles.suggestItem, { | ||
selected: _vm.selected && _vm.valueProperty(suggestion) == _vm.valueProperty(_vm.selected), | ||
} } }, [!!this.$scopedSlots['misc-item-above'] ? _c('li', [_vm._t("misc-item-above", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e(), _vm._v(" "), _vm._l(_vm.suggestions, function (suggestion, index) { | ||
return _c('li', { key: _vm.getId(suggestion, index), staticClass: "suggest-item", class: [_vm.styles.suggestItem, { selected: _vm.selected && _vm.valueProperty(suggestion) == _vm.valueProperty(_vm.selected), | ||
hover: _vm.hovered && _vm.valueProperty(_vm.hovered) == _vm.valueProperty(suggestion) | ||
}], on: { "mouseenter": function mouseenter($event) { | ||
}], attrs: { "role": "option", "aria-selected": _vm.hovered && _vm.valueProperty(_vm.hovered) == _vm.valueProperty(suggestion) ? 'true' : 'false', "id": _vm.getId(suggestion, index) }, on: { "mouseenter": function mouseenter($event) { | ||
_vm.hover(suggestion, $event.target); | ||
}, "mouseleave": function mouseleave($event) { | ||
_vm.hover(null, $event.target); | ||
_vm.hover(undefined); | ||
}, "click": function click($event) { | ||
_vm.suggestionClick(suggestion, $event); | ||
} } }, [_vm._t("suggestion-item", [_c('span', [_vm._v(_vm._s(_vm.displayProperty(suggestion)))])], { autocomplete: function autocomplete() { | ||
return _vm.autocompleteText(_vm.displayProperty(suggestion)); | ||
return _vm.setText(_vm.displayProperty(suggestion)); | ||
}, suggestion: suggestion, query: _vm.text })], 2); | ||
}), _vm._v(" "), _vm._t("misc-item-below", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e()])], 1); | ||
}), _vm._v(" "), !!this.$scopedSlots['misc-item-below'] ? _c('li', [_vm._t("misc-item-below", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e()], 2) : _vm._e()])], 1); | ||
}, | ||
staticRenderFns: [], | ||
name: 'vue-simple-suggest', | ||
model: { | ||
name: 'vue-simple-suggest', model: { | ||
prop: 'value', | ||
get event() { | ||
return event; | ||
} | ||
}, props: { | ||
event: 'input' | ||
}, | ||
props: { | ||
styles: { | ||
@@ -162,3 +156,4 @@ type: Object, | ||
type: String, | ||
default: 'title' }, | ||
default: 'title' | ||
}, | ||
valueAttribute: { | ||
@@ -200,2 +195,6 @@ type: String, | ||
}, | ||
nullableSelect: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
value: {}, | ||
@@ -214,3 +213,16 @@ mode: { | ||
handler: function handler(current, old) { | ||
event = current; | ||
var _this = this; | ||
this.constructor.options.model.event = current; | ||
if (this.$parent) { | ||
this.$parent.$forceUpdate(); | ||
} else { | ||
this.$emit('input', this.text); | ||
this.$emit('select', this.selected); | ||
} | ||
this.$nextTick(function () { | ||
_this.$emit('input', _this.text); | ||
_this.$emit('select', _this.selected); | ||
}); | ||
}, | ||
@@ -222,3 +234,7 @@ | ||
handler: function handler(current) { | ||
this.text = current; | ||
if (typeof current === 'string') { | ||
this.text = current; | ||
} else if (current) { | ||
this.text = this.displayProperty(current); | ||
} | ||
}, | ||
@@ -246,3 +262,4 @@ | ||
isTabbed: false, | ||
controlScheme: {} | ||
controlScheme: {}, | ||
listId: this._uid + '-suggestions' | ||
}; | ||
@@ -268,6 +285,6 @@ }, | ||
hoveredIndex: function hoveredIndex() { | ||
var _this = this; | ||
var _this2 = this; | ||
return this.suggestions.findIndex(function (el) { | ||
return _this.hovered && _this.valueProperty(_this.hovered) == _this.valueProperty(el); | ||
return _this2.hovered && _this2.valueProperty(_this2.hovered) == _this2.valueProperty(el); | ||
}); | ||
@@ -277,2 +294,5 @@ }, | ||
return this.text && this.text.length || this.inputElement.value.length || 0; | ||
}, | ||
isSelectedUpToDate: function isSelectedUpToDate() { | ||
return !!this.selected && this.displayProperty(this.selected) === this.text; | ||
} | ||
@@ -286,2 +306,3 @@ }, | ||
this.setInputAriaAttributes(); | ||
this.prepareEventHandlers(true); | ||
@@ -300,4 +321,9 @@ }, | ||
}, | ||
setInputAriaAttributes: function setInputAriaAttributes() { | ||
this.inputElement.setAttribute('aria-activedescendant', ''); | ||
this.inputElement.setAttribute('aria-autocomplete', 'list'); | ||
this.inputElement.setAttribute('aria-controls', this.listId); | ||
}, | ||
prepareEventHandlers: function prepareEventHandlers(enable) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
@@ -308,3 +334,3 @@ var binder = this[enable ? 'on' : 'off']; | ||
keydown: function keydown($event) { | ||
return _this2.moveSelection($event), _this2.onAutocomplete($event); | ||
return _this3.moveSelection($event), _this3.onAutocomplete($event); | ||
}, | ||
@@ -345,6 +371,6 @@ keyup: this.onListKeyUp | ||
miscSlotsAreEmpty: function miscSlotsAreEmpty() { | ||
var _this3 = this; | ||
var _this4 = this; | ||
var slots = ['misc-item-above', 'misc-item-below'].map(function (s) { | ||
return _this3.$scopedSlots[s]; | ||
return _this4.$scopedSlots[s]; | ||
}); | ||
@@ -373,9 +399,20 @@ | ||
}, | ||
/** | ||
* @deprecated remove on the next release | ||
*/ | ||
autocompleteText: function autocompleteText(text) { | ||
this.$emit('input', text); | ||
this.inputElement.value = text; | ||
this.text = text; | ||
this.setText(text); | ||
}, | ||
setText: function setText(text) { | ||
var _this5 = this; | ||
this.$nextTick(function () { | ||
_this5.$emit('input', text); | ||
_this5.inputElement.value = text; | ||
_this5.text = text; | ||
}); | ||
}, | ||
select: function select(item) { | ||
this.hovered = null; | ||
this.selected = item; | ||
@@ -385,8 +422,11 @@ | ||
this.autocompleteText(this.displayProperty(item)); | ||
this.hover(null); | ||
this.setText(this.displayProperty(item)); | ||
}, | ||
hover: function hover(item, elem) { | ||
this.hovered = item; | ||
var elemId = !!item ? this.getId(item, this.hoveredIndex) : ''; | ||
if (this.hovered != null) { | ||
this.inputElement.setAttribute('aria-activedescendant', elemId); | ||
if (item !== undefined) { | ||
this.$emit('hover', item, elem); | ||
@@ -401,2 +441,3 @@ } | ||
this.listShown = false; | ||
this.hover(null); | ||
this.$emit('hide-list'); | ||
@@ -414,13 +455,14 @@ } | ||
showSuggestions: _async(function () { | ||
var _this4 = this; | ||
var _this6 = this; | ||
return _invoke(function () { | ||
if (_this4.suggestions.length === 0 && _this4.minLength === _this4.textLength) { | ||
return _awaitIgnored(_this4.research()); | ||
if (_this6.suggestions.length === 0 && _this6.minLength === _this6.textLength) { | ||
return _awaitIgnored(_this6.research()); | ||
} | ||
}, function () { | ||
_this4.showList(); | ||
_this6.showList(); | ||
}); | ||
}), | ||
moveSelection: function moveSelection(e) { | ||
if (!this.listShown || !this.suggestions.length) return; | ||
if (hasKeyCode([this.controlScheme.selectionUp, this.controlScheme.selectionDown], e)) { | ||
@@ -444,3 +486,2 @@ e.preventDefault(); | ||
} | ||
this.hover(item); | ||
@@ -456,3 +497,3 @@ } | ||
if (this.listShown) { | ||
if (hasKeyCode(select, e) && this.hovered) { | ||
if (hasKeyCode(select, e) && (this.nullableSelect || this.hovered)) { | ||
this.select(this.hovered); | ||
@@ -471,15 +512,20 @@ } | ||
this.hover(this.suggestions[0]); | ||
this.autocompleteText(this.displayProperty(this.suggestions[0])); | ||
this.setText(this.displayProperty(this.suggestions[0])); | ||
} | ||
}, | ||
suggestionClick: function suggestionClick(suggestion, e) { | ||
var _this7 = this; | ||
this.$emit('suggestion-click', suggestion, e); | ||
this.select(suggestion); | ||
this.hideList(); | ||
/// Ensure, that all needed flags are off before finishing the click. | ||
this.isClicking = this.isOverList = false; | ||
this.$nextTick(function () { | ||
_this7.hideList(); | ||
}); | ||
}, | ||
onBlur: function onBlur(e) { | ||
var _this5 = this; | ||
var _this8 = this; | ||
@@ -500,3 +546,3 @@ if (this.isInFocus) { | ||
this.$nextTick(function () { | ||
_this5.inputElement.focus(); | ||
_this8.inputElement.focus(); | ||
}); | ||
@@ -506,3 +552,3 @@ } | ||
this.inputElement.blur(); | ||
console.error('This should never happen!\n If you encouneterd this error, please report at https://github.com/KazanExpress/vue-simple-suggest/issues'); | ||
console.error('This should never happen!\n If you encountered this error, please make sure that your input component emits \'focus\' events properly.\n For more info see https://github.com/KazanExpress/vue-simple-suggest#custom-input.\n\n If your \'vue-simple-suggest\' setup does not include a custom input component - please,\n report to https://github.com/KazanExpress/vue-simple-suggest/issues/new'); | ||
} | ||
@@ -536,6 +582,3 @@ | ||
if (this.selected) { | ||
this.selected = null; | ||
this.$emit('select', null); | ||
} | ||
if (this.hovered) this.hover(null); | ||
@@ -550,3 +593,3 @@ if (this.debounce) { | ||
research: _async(function () { | ||
var _this6 = this; | ||
var _this9 = this; | ||
@@ -556,7 +599,7 @@ return _finally(function () { | ||
return _invokeIgnored(function () { | ||
if (_this6.canSend) { | ||
_this6.canSend = false; | ||
var _$set = _this6.$set; | ||
return _await(_this6.getSuggestions(_this6.text), function (_this6$getSuggestions) { | ||
_$set.call(_this6, _this6, 'suggestions', _this6$getSuggestions); | ||
if (_this9.canSend) { | ||
_this9.canSend = false; | ||
var _$set = _this9.$set; | ||
return _await(_this9.getSuggestions(_this9.text), function (_this9$getSuggestions) { | ||
_$set.call(_this9, _this9, 'suggestions', _this9$getSuggestions); | ||
}); | ||
@@ -566,39 +609,39 @@ } | ||
}, function (e) { | ||
_this6.clearSuggestions(); | ||
_this9.clearSuggestions(); | ||
throw e; | ||
}); | ||
}, function () { | ||
_this6.canSend = true; | ||
_this9.canSend = true; | ||
if (_this6.suggestions.length === 0 && _this6.miscSlotsAreEmpty()) { | ||
_this6.hideList(); | ||
if (_this9.suggestions.length === 0 && _this9.miscSlotsAreEmpty()) { | ||
_this9.hideList(); | ||
} else { | ||
_this6.showList(); | ||
_this9.showList(); | ||
} | ||
return _this6.suggestions; | ||
return _this9.suggestions; | ||
}); | ||
}), | ||
getSuggestions: _async(function (value) { | ||
var _this7 = this; | ||
var _this10 = this; | ||
value = value || ''; | ||
if (value.length < _this7.minLength) { | ||
if (_this7.listShown) { | ||
_this7.hideList(); | ||
if (value.length < _this10.minLength) { | ||
if (_this10.listShown) { | ||
_this10.hideList(); | ||
return []; | ||
} | ||
return _this7.suggestions; | ||
return _this10.suggestions; | ||
} | ||
_this7.selected = null; | ||
_this10.selected = null; | ||
// Start request if can | ||
if (_this7.listIsRequest) { | ||
_this7.$emit('request-start', value); | ||
if (_this10.listIsRequest) { | ||
_this10.$emit('request-start', value); | ||
if (_this7.suggestions.length > 0 || !_this7.miscSlotsAreEmpty()) { | ||
_this7.showList(); | ||
if (_this10.suggestions.length > 0 || !_this10.miscSlotsAreEmpty()) { | ||
_this10.showList(); | ||
} | ||
@@ -611,8 +654,8 @@ } | ||
return _invoke(function () { | ||
if (_this7.listIsRequest) { | ||
return _await(_this7.list(value), function (_this7$list) { | ||
result = _this7$list || []; | ||
if (_this10.listIsRequest) { | ||
return _await(_this10.list(value), function (_this10$list) { | ||
result = _this10$list || []; | ||
}); | ||
} else { | ||
result = _this7.list; | ||
result = _this10.list; | ||
} | ||
@@ -625,17 +668,17 @@ }, function () { | ||
_this7.isPlainSuggestion = _typeof(result[0]) !== 'object' || Array.isArray(result[0]); | ||
_this10.isPlainSuggestion = _typeof(result[0]) !== 'object' || Array.isArray(result[0]); | ||
if (_this7.filterByQuery) { | ||
if (_this10.filterByQuery) { | ||
result = result.filter(function (el) { | ||
return _this7.filter(el, value); | ||
return _this10.filter(el, value); | ||
}); | ||
} | ||
if (_this7.listIsRequest) { | ||
_this7.$emit('request-done', result); | ||
if (_this10.listIsRequest) { | ||
_this10.$emit('request-done', result); | ||
} | ||
}); | ||
}, function (e) { | ||
if (_this7.listIsRequest) { | ||
_this7.$emit('request-failed', e); | ||
if (_this10.listIsRequest) { | ||
_this10.$emit('request-failed', e); | ||
} else { | ||
@@ -646,4 +689,4 @@ throw e; | ||
}, function () { | ||
if (_this7.maxSuggestions) { | ||
result.splice(_this7.maxSuggestions); | ||
if (_this10.maxSuggestions) { | ||
result.splice(_this10.maxSuggestions); | ||
} | ||
@@ -656,2 +699,5 @@ | ||
this.suggestions.splice(0); | ||
}, | ||
getId: function getId(value, i) { | ||
return this.listId + '-suggestion-' + (this.isPlainSuggestion ? i : this.valueProperty(value)); | ||
} | ||
@@ -658,0 +704,0 @@ } |
117
dist/es6.js
@@ -49,4 +49,3 @@ const defaultControls = { | ||
} | ||
} | ||
function _await(value, then, direct) { | ||
}function _await(value, then, direct) { | ||
if (direct) { | ||
@@ -87,4 +86,2 @@ return then ? then(value) : value; | ||
}function _empty() {} | ||
let event = 'input'; | ||
var VueSimpleSuggest = { | ||
@@ -96,29 +93,26 @@ render: function () { | ||
}_vm.isTabbed = true; | ||
} } }, [_c('div', { ref: "inputSlot", staticClass: "input-wrapper", class: _vm.styles.inputWrapper }, [_vm._t("default", [_c('input', _vm._b({ staticClass: "default-input", class: _vm.styles.defaultInput, domProps: { "value": _vm.text || '' } }, 'input', _vm.$attrs, false))])], 2), _vm._v(" "), _c('transition', { attrs: { "name": "vue-simple-suggest" } }, [!!_vm.listShown && !_vm.removeList ? _c('div', { staticClass: "suggestions", class: _vm.styles.suggestions, on: { "mouseenter": function ($event) { | ||
} } }, [_c('div', { ref: "inputSlot", staticClass: "input-wrapper", class: _vm.styles.inputWrapper, attrs: { "role": "combobox", "aria-haspopup": "listbox", "aria-owns": _vm.listId, "aria-expanded": !!_vm.listShown && !_vm.removeList ? 'true' : 'false' } }, [_vm._t("default", [_c('input', _vm._b({ staticClass: "default-input", class: _vm.styles.defaultInput, domProps: { "value": _vm.text || '' } }, 'input', _vm.$attrs, false))])], 2), _vm._v(" "), _c('transition', { attrs: { "name": "vue-simple-suggest" } }, [!!_vm.listShown && !_vm.removeList ? _c('ul', { staticClass: "suggestions", class: _vm.styles.suggestions, attrs: { "id": _vm.listId, "role": "listbox", "aria-labelledby": _vm.listId }, on: { "mouseenter": function ($event) { | ||
_vm.hoverList(true); | ||
}, "mouseleave": function ($event) { | ||
_vm.hoverList(false); | ||
} } }, [_vm._t("misc-item-above", null, { suggestions: _vm.suggestions, query: _vm.text }), _vm._v(" "), _vm._l(_vm.suggestions, function (suggestion, index) { | ||
return _c('div', { key: _vm.isPlainSuggestion ? 'suggestion-' + index : _vm.valueProperty(suggestion), staticClass: "suggest-item", class: [_vm.styles.suggestItem, { | ||
selected: _vm.selected && _vm.valueProperty(suggestion) == _vm.valueProperty(_vm.selected), | ||
} } }, [!!this.$scopedSlots['misc-item-above'] ? _c('li', [_vm._t("misc-item-above", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e(), _vm._v(" "), _vm._l(_vm.suggestions, function (suggestion, index) { | ||
return _c('li', { key: _vm.getId(suggestion, index), staticClass: "suggest-item", class: [_vm.styles.suggestItem, { selected: _vm.selected && _vm.valueProperty(suggestion) == _vm.valueProperty(_vm.selected), | ||
hover: _vm.hovered && _vm.valueProperty(_vm.hovered) == _vm.valueProperty(suggestion) | ||
}], on: { "mouseenter": function ($event) { | ||
}], attrs: { "role": "option", "aria-selected": _vm.hovered && _vm.valueProperty(_vm.hovered) == _vm.valueProperty(suggestion) ? 'true' : 'false', "id": _vm.getId(suggestion, index) }, on: { "mouseenter": function ($event) { | ||
_vm.hover(suggestion, $event.target); | ||
}, "mouseleave": function ($event) { | ||
_vm.hover(null, $event.target); | ||
_vm.hover(undefined); | ||
}, "click": function ($event) { | ||
_vm.suggestionClick(suggestion, $event); | ||
} } }, [_vm._t("suggestion-item", [_c('span', [_vm._v(_vm._s(_vm.displayProperty(suggestion)))])], { autocomplete: function () { | ||
return _vm.autocompleteText(_vm.displayProperty(suggestion)); | ||
return _vm.setText(_vm.displayProperty(suggestion)); | ||
}, suggestion: suggestion, query: _vm.text })], 2); | ||
}), _vm._v(" "), _vm._t("misc-item-below", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e()])], 1); | ||
}), _vm._v(" "), !!this.$scopedSlots['misc-item-below'] ? _c('li', [_vm._t("misc-item-below", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e()], 2) : _vm._e()])], 1); | ||
}, | ||
staticRenderFns: [], | ||
name: 'vue-simple-suggest', | ||
model: { | ||
name: 'vue-simple-suggest', model: { | ||
prop: 'value', | ||
get event() { | ||
return event; | ||
} | ||
}, props: { | ||
event: 'input' | ||
}, | ||
props: { | ||
styles: { | ||
@@ -142,3 +136,4 @@ type: Object, | ||
type: String, | ||
default: 'title' }, | ||
default: 'title' | ||
}, | ||
valueAttribute: { | ||
@@ -178,2 +173,6 @@ type: String, | ||
}, | ||
nullableSelect: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
value: {}, | ||
@@ -190,3 +189,14 @@ mode: { | ||
handler(current, old) { | ||
event = current; | ||
this.constructor.options.model.event = current; | ||
if (this.$parent) { | ||
this.$parent.$forceUpdate(); | ||
} else { | ||
this.$emit('input', this.text); | ||
this.$emit('select', this.selected); | ||
} | ||
this.$nextTick(() => { | ||
this.$emit('input', this.text); | ||
this.$emit('select', this.selected); | ||
}); | ||
}, | ||
@@ -197,3 +207,7 @@ immediate: true | ||
handler(current) { | ||
this.text = current; | ||
if (typeof current === 'string') { | ||
this.text = current; | ||
} else if (current) { | ||
this.text = this.displayProperty(current); | ||
} | ||
}, | ||
@@ -220,3 +234,4 @@ immediate: true | ||
isTabbed: false, | ||
controlScheme: {} | ||
controlScheme: {}, | ||
listId: `${this._uid}-suggestions` | ||
}; | ||
@@ -245,2 +260,5 @@ }, | ||
return this.text && this.text.length || this.inputElement.value.length || 0; | ||
}, | ||
isSelectedUpToDate() { | ||
return !!this.selected && this.displayProperty(this.selected) === this.text; | ||
} | ||
@@ -254,2 +272,3 @@ }, | ||
this.setInputAriaAttributes(); | ||
this.prepareEventHandlers(true); | ||
@@ -267,2 +286,7 @@ }, | ||
}, | ||
setInputAriaAttributes() { | ||
this.inputElement.setAttribute('aria-activedescendant', ''); | ||
this.inputElement.setAttribute('aria-autocomplete', 'list'); | ||
this.inputElement.setAttribute('aria-controls', this.listId); | ||
}, | ||
prepareEventHandlers(enable) { | ||
@@ -326,9 +350,17 @@ const binder = this[enable ? 'on' : 'off']; | ||
}, | ||
/** | ||
* @deprecated remove on the next release | ||
*/ | ||
autocompleteText(text) { | ||
this.$emit('input', text); | ||
this.inputElement.value = text; | ||
this.text = text; | ||
this.setText(text); | ||
}, | ||
setText(text) { | ||
this.$nextTick(() => { | ||
this.$emit('input', text); | ||
this.inputElement.value = text; | ||
this.text = text; | ||
}); | ||
}, | ||
select(item) { | ||
this.hovered = null; | ||
this.selected = item; | ||
@@ -338,8 +370,11 @@ | ||
this.autocompleteText(this.displayProperty(item)); | ||
this.hover(null); | ||
this.setText(this.displayProperty(item)); | ||
}, | ||
hover(item, elem) { | ||
this.hovered = item; | ||
const elemId = !!item ? this.getId(item, this.hoveredIndex) : ''; | ||
if (this.hovered != null) { | ||
this.inputElement.setAttribute('aria-activedescendant', elemId); | ||
if (item !== undefined) { | ||
this.$emit('hover', item, elem); | ||
@@ -354,2 +389,3 @@ } | ||
this.listShown = false; | ||
this.hover(null); | ||
this.$emit('hide-list'); | ||
@@ -379,2 +415,3 @@ } | ||
moveSelection(e) { | ||
if (!this.listShown || !this.suggestions.length) return; | ||
if (hasKeyCode([this.controlScheme.selectionUp, this.controlScheme.selectionDown], e)) { | ||
@@ -398,3 +435,2 @@ e.preventDefault(); | ||
} | ||
this.hover(item); | ||
@@ -410,3 +446,3 @@ } | ||
if (this.listShown) { | ||
if (hasKeyCode(select, e) && this.hovered) { | ||
if (hasKeyCode(select, e) && (this.nullableSelect || this.hovered)) { | ||
this.select(this.hovered); | ||
@@ -425,3 +461,3 @@ } | ||
this.hover(this.suggestions[0]); | ||
this.autocompleteText(this.displayProperty(this.suggestions[0])); | ||
this.setText(this.displayProperty(this.suggestions[0])); | ||
} | ||
@@ -432,6 +468,9 @@ }, | ||
this.select(suggestion); | ||
this.hideList(); | ||
/// Ensure, that all needed flags are off before finishing the click. | ||
this.isClicking = this.isOverList = false; | ||
this.$nextTick(() => { | ||
this.hideList(); | ||
}); | ||
}, | ||
@@ -459,3 +498,7 @@ onBlur(e) { | ||
console.error(`This should never happen! | ||
If you encouneterd this error, please report at https://github.com/KazanExpress/vue-simple-suggest/issues`); | ||
If you encountered this error, please make sure that your input component emits 'focus' events properly. | ||
For more info see https://github.com/KazanExpress/vue-simple-suggest#custom-input. | ||
If your 'vue-simple-suggest' setup does not include a custom input component - please, | ||
report to https://github.com/KazanExpress/vue-simple-suggest/issues/new`); | ||
} | ||
@@ -489,6 +532,3 @@ | ||
if (this.selected) { | ||
this.selected = null; | ||
this.$emit('select', null); | ||
} | ||
if (this.hovered) this.hover(null); | ||
@@ -602,2 +642,5 @@ if (this.debounce) { | ||
this.suggestions.splice(0); | ||
}, | ||
getId(value, i) { | ||
return `${this.listId}-suggestion-${this.isPlainSuggestion ? i : this.valueProperty(value)}`; | ||
} | ||
@@ -604,0 +647,0 @@ } |
104
dist/es7.js
@@ -29,4 +29,2 @@ const defaultControls = { | ||
let event = 'input'; | ||
var VueSimpleSuggest = { | ||
@@ -38,20 +36,20 @@ render: function () { | ||
}_vm.isTabbed = true; | ||
} } }, [_c('div', { ref: "inputSlot", staticClass: "input-wrapper", class: _vm.styles.inputWrapper }, [_vm._t("default", [_c('input', _vm._b({ staticClass: "default-input", class: _vm.styles.defaultInput, domProps: { "value": _vm.text || '' } }, 'input', _vm.$attrs, false))])], 2), _vm._v(" "), _c('transition', { attrs: { "name": "vue-simple-suggest" } }, [!!_vm.listShown && !_vm.removeList ? _c('div', { staticClass: "suggestions", class: _vm.styles.suggestions, on: { "mouseenter": function ($event) { | ||
} } }, [_c('div', { ref: "inputSlot", staticClass: "input-wrapper", class: _vm.styles.inputWrapper, attrs: { "role": "combobox", "aria-haspopup": "listbox", "aria-owns": _vm.listId, "aria-expanded": !!_vm.listShown && !_vm.removeList ? 'true' : 'false' } }, [_vm._t("default", [_c('input', _vm._b({ staticClass: "default-input", class: _vm.styles.defaultInput, domProps: { "value": _vm.text || '' } }, 'input', _vm.$attrs, false))])], 2), _vm._v(" "), _c('transition', { attrs: { "name": "vue-simple-suggest" } }, [!!_vm.listShown && !_vm.removeList ? _c('ul', { staticClass: "suggestions", class: _vm.styles.suggestions, attrs: { "id": _vm.listId, "role": "listbox", "aria-labelledby": _vm.listId }, on: { "mouseenter": function ($event) { | ||
_vm.hoverList(true); | ||
}, "mouseleave": function ($event) { | ||
_vm.hoverList(false); | ||
} } }, [_vm._t("misc-item-above", null, { suggestions: _vm.suggestions, query: _vm.text }), _vm._v(" "), _vm._l(_vm.suggestions, function (suggestion, index) { | ||
return _c('div', { key: _vm.isPlainSuggestion ? 'suggestion-' + index : _vm.valueProperty(suggestion), staticClass: "suggest-item", class: [_vm.styles.suggestItem, { | ||
} } }, [!!this.$scopedSlots['misc-item-above'] ? _c('li', [_vm._t("misc-item-above", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e(), _vm._v(" "), _vm._l(_vm.suggestions, function (suggestion, index) { | ||
return _c('li', { key: _vm.getId(suggestion, index), staticClass: "suggest-item", class: [_vm.styles.suggestItem, { | ||
selected: _vm.selected && _vm.valueProperty(suggestion) == _vm.valueProperty(_vm.selected), | ||
hover: _vm.hovered && _vm.valueProperty(_vm.hovered) == _vm.valueProperty(suggestion) | ||
}], on: { "mouseenter": function ($event) { | ||
}], attrs: { "role": "option", "aria-selected": _vm.hovered && _vm.valueProperty(_vm.hovered) == _vm.valueProperty(suggestion) ? 'true' : 'false', "id": _vm.getId(suggestion, index) }, on: { "mouseenter": function ($event) { | ||
_vm.hover(suggestion, $event.target); | ||
}, "mouseleave": function ($event) { | ||
_vm.hover(null, $event.target); | ||
_vm.hover(undefined); | ||
}, "click": function ($event) { | ||
_vm.suggestionClick(suggestion, $event); | ||
} } }, [_vm._t("suggestion-item", [_c('span', [_vm._v(_vm._s(_vm.displayProperty(suggestion)))])], { autocomplete: function () { | ||
return _vm.autocompleteText(_vm.displayProperty(suggestion)); | ||
return _vm.setText(_vm.displayProperty(suggestion)); | ||
}, suggestion: suggestion, query: _vm.text })], 2); | ||
}), _vm._v(" "), _vm._t("misc-item-below", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e()])], 1); | ||
}), _vm._v(" "), !!this.$scopedSlots['misc-item-below'] ? _c('li', [_vm._t("misc-item-below", null, { suggestions: _vm.suggestions, query: _vm.text })], 2) : _vm._e()], 2) : _vm._e()])], 1); | ||
}, | ||
@@ -62,5 +60,3 @@ staticRenderFns: [], | ||
prop: 'value', | ||
get event() { | ||
return event; | ||
} | ||
event: 'input' | ||
}, | ||
@@ -122,2 +118,6 @@ props: { | ||
}, | ||
nullableSelect: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
value: {}, | ||
@@ -134,3 +134,14 @@ mode: { | ||
handler(current, old) { | ||
event = current; | ||
this.constructor.options.model.event = current; | ||
if (this.$parent) { | ||
this.$parent.$forceUpdate(); | ||
} else { | ||
this.$emit('input', this.text); | ||
this.$emit('select', this.selected); | ||
} | ||
this.$nextTick(() => { | ||
this.$emit('input', this.text); | ||
this.$emit('select', this.selected); | ||
}); | ||
}, | ||
@@ -141,3 +152,7 @@ immediate: true | ||
handler(current) { | ||
this.text = current; | ||
if (typeof current === 'string') { | ||
this.text = current; | ||
} else if (current) { | ||
this.text = this.displayProperty(current); | ||
} | ||
}, | ||
@@ -164,3 +179,4 @@ immediate: true | ||
isTabbed: false, | ||
controlScheme: {} | ||
controlScheme: {}, | ||
listId: `${this._uid}-suggestions` | ||
}; | ||
@@ -189,2 +205,5 @@ }, | ||
return this.text && this.text.length || this.inputElement.value.length || 0; | ||
}, | ||
isSelectedUpToDate() { | ||
return !!this.selected && this.displayProperty(this.selected) === this.text; | ||
} | ||
@@ -198,2 +217,3 @@ }, | ||
this.setInputAriaAttributes(); | ||
this.prepareEventHandlers(true); | ||
@@ -211,2 +231,7 @@ }, | ||
}, | ||
setInputAriaAttributes() { | ||
this.inputElement.setAttribute('aria-activedescendant', ''); | ||
this.inputElement.setAttribute('aria-autocomplete', 'list'); | ||
this.inputElement.setAttribute('aria-controls', this.listId); | ||
}, | ||
prepareEventHandlers(enable) { | ||
@@ -270,9 +295,17 @@ const binder = this[enable ? 'on' : 'off']; | ||
}, | ||
/** | ||
* @deprecated remove on the next release | ||
*/ | ||
autocompleteText(text) { | ||
this.$emit('input', text); | ||
this.inputElement.value = text; | ||
this.text = text; | ||
this.setText(text); | ||
}, | ||
setText(text) { | ||
this.$nextTick(() => { | ||
this.$emit('input', text); | ||
this.inputElement.value = text; | ||
this.text = text; | ||
}); | ||
}, | ||
select(item) { | ||
this.hovered = null; | ||
this.selected = item; | ||
@@ -282,8 +315,11 @@ | ||
this.autocompleteText(this.displayProperty(item)); | ||
this.hover(null); | ||
this.setText(this.displayProperty(item)); | ||
}, | ||
hover(item, elem) { | ||
this.hovered = item; | ||
const elemId = !!item ? this.getId(item, this.hoveredIndex) : ''; | ||
if (this.hovered != null) { | ||
this.inputElement.setAttribute('aria-activedescendant', elemId); | ||
if (item !== undefined) { | ||
this.$emit('hover', item, elem); | ||
@@ -298,2 +334,3 @@ } | ||
this.listShown = false; | ||
this.hover(null); | ||
this.$emit('hide-list'); | ||
@@ -318,2 +355,3 @@ } | ||
moveSelection(e) { | ||
if (!this.listShown || !this.suggestions.length) return; | ||
if (hasKeyCode([this.controlScheme.selectionUp, this.controlScheme.selectionDown], e)) { | ||
@@ -337,3 +375,2 @@ e.preventDefault(); | ||
} | ||
this.hover(item); | ||
@@ -349,3 +386,3 @@ } | ||
if (this.listShown) { | ||
if (hasKeyCode(select, e) && this.hovered) { | ||
if (hasKeyCode(select, e) && (this.nullableSelect || this.hovered)) { | ||
this.select(this.hovered); | ||
@@ -364,3 +401,3 @@ } | ||
this.hover(this.suggestions[0]); | ||
this.autocompleteText(this.displayProperty(this.suggestions[0])); | ||
this.setText(this.displayProperty(this.suggestions[0])); | ||
} | ||
@@ -371,6 +408,9 @@ }, | ||
this.select(suggestion); | ||
this.hideList(); | ||
/// Ensure, that all needed flags are off before finishing the click. | ||
this.isClicking = this.isOverList = false; | ||
this.$nextTick(() => { | ||
this.hideList(); | ||
}); | ||
}, | ||
@@ -398,3 +438,7 @@ onBlur(e) { | ||
console.error(`This should never happen! | ||
If you encouneterd this error, please report at https://github.com/KazanExpress/vue-simple-suggest/issues`); | ||
If you encountered this error, please make sure that your input component emits 'focus' events properly. | ||
For more info see https://github.com/KazanExpress/vue-simple-suggest#custom-input. | ||
If your 'vue-simple-suggest' setup does not include a custom input component - please, | ||
report to https://github.com/KazanExpress/vue-simple-suggest/issues/new`); | ||
} | ||
@@ -428,6 +472,3 @@ | ||
if (this.selected) { | ||
this.selected = null; | ||
this.$emit('select', null); | ||
} | ||
if (this.hovered) this.hover(null); | ||
@@ -523,2 +564,5 @@ if (this.debounce) { | ||
this.suggestions.splice(0); | ||
}, | ||
getId(value, i) { | ||
return `${this.listId}-suggestion-${this.isPlainSuggestion ? i : this.valueProperty(value)}`; | ||
} | ||
@@ -525,0 +569,0 @@ } |
@@ -1,1 +0,1 @@ | ||
var VueSimpleSuggest=function(){"use strict";var t={selectionUp:[38],selectionDown:[40],select:[13],hideList:[27],autocomplete:[32,13]},e={input:String,select:Object};function n(t,e){if(t.length<=0)return!1;var n=function(t){return t.some(function(t){return t===e.keyCode})};return Array.isArray(t[0])?t.some(function(t){return n(t)}):n(t)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};function o(t,e){try{var n=t()}catch(t){return e()}return n&&n.then?n.then(e,e):e()}function r(t,e){try{var n=t()}catch(t){return e(t)}return n&&n.then?n.then(void 0,e):n}function u(t,e,n){return n?e?e(t):t:(t=Promise.resolve(t),e?t.then(e):t)}var l=function(){try{if(isNaN.apply(null,{}))return function(t){return function(){try{return Promise.resolve(t.apply(this,arguments))}catch(t){return Promise.reject(t)}}}}catch(t){}return function(t){return function(){try{return Promise.resolve(t.apply(this,Array.prototype.slice.call(arguments)))}catch(t){return Promise.reject(t)}}}}();function c(t,e){var n=t();return n&&n.then?n.then(e):e(n)}function h(){}var a="input",f={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vue-simple-suggest",class:[t.styles.vueSimpleSuggest,{designed:!t.destyled,focus:t.isInFocus}],on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.isTabbed=!0}}},[n("div",{ref:"inputSlot",staticClass:"input-wrapper",class:t.styles.inputWrapper},[t._t("default",[n("input",t._b({staticClass:"default-input",class:t.styles.defaultInput,domProps:{value:t.text||""}},"input",t.$attrs,!1))])],2),t._v(" "),n("transition",{attrs:{name:"vue-simple-suggest"}},[t.listShown&&!t.removeList?n("div",{staticClass:"suggestions",class:t.styles.suggestions,on:{mouseenter:function(e){t.hoverList(!0)},mouseleave:function(e){t.hoverList(!1)}}},[t._t("misc-item-above",null,{suggestions:t.suggestions,query:t.text}),t._v(" "),t._l(t.suggestions,function(e,i){return n("div",{key:t.isPlainSuggestion?"suggestion-"+i:t.valueProperty(e),staticClass:"suggest-item",class:[t.styles.suggestItem,{selected:t.selected&&t.valueProperty(e)==t.valueProperty(t.selected),hover:t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)}],on:{mouseenter:function(n){t.hover(e,n.target)},mouseleave:function(e){t.hover(null,e.target)},click:function(n){t.suggestionClick(e,n)}}},[t._t("suggestion-item",[n("span",[t._v(t._s(t.displayProperty(e)))])],{autocomplete:function(){return t.autocompleteText(t.displayProperty(e))},suggestion:e,query:t.text})],2)}),t._v(" "),t._t("misc-item-below",null,{suggestions:t.suggestions,query:t.text})],2):t._e()])],1)},staticRenderFns:[],name:"vue-simple-suggest",model:{prop:"value",get event(){return a}},props:{styles:{type:Object,default:function(){return{}}},controls:{type:Object,default:function(){return t}},minLength:{type:Number,default:1},maxSuggestions:{type:Number,default:10},displayAttribute:{type:String,default:"title"},valueAttribute:{type:String,default:"id"},list:{type:[Function,Array],default:function(){return[]}},removeList:{type:Boolean,default:!1},destyled:{type:Boolean,default:!1},preventSubmit:{type:Boolean,default:!0},filterByQuery:{type:Boolean,default:!1},filter:{type:Function,default:function(t,e){return!e||~this.displayProperty(t).toLowerCase().indexOf(e.toLowerCase())}},debounce:{type:Number,default:0},value:{},mode:{type:String,default:a,validator:function(t){return!!~Object.keys(e).indexOf(t.toLowerCase())}}},watch:{mode:{handler:function(t,e){a=t},immediate:!0},value:{handler:function(t){this.text=t},immediate:!0}},data:function(){return{selected:null,hovered:null,suggestions:[],listShown:!1,inputElement:null,canSend:!0,timeoutInstance:null,text:this.value,isPlainSuggestion:!1,isClicking:!1,isOverList:!1,isInFocus:!1,isFalseFocus:!1,isTabbed:!1,controlScheme:{}}},computed:{listIsRequest:function(){return"function"==typeof this.list},inputIsComponent:function(){return this.$slots.default&&this.$slots.default.length>0&&!!this.$slots.default[0].componentInstance},input:function(){return this.inputIsComponent?this.$slots.default[0].componentInstance:this.inputElement},on:function(){return this.inputIsComponent?"$on":"addEventListener"},off:function(){return this.inputIsComponent?"$off":"removeEventListener"},hoveredIndex:function(){var t=this;return this.suggestions.findIndex(function(e){return t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)})},textLength:function(){return this.text&&this.text.length||this.inputElement.value.length||0}},created:function(){this.controlScheme=s({},t,this.controls)},mounted:function(){this.inputElement=this.$refs.inputSlot.querySelector("input"),this.prepareEventHandlers(!0)},beforeDestroy:function(){this.prepareEventHandlers(!1)},methods:{onSubmit:function(t){this.preventSubmit&&"Enter"===t.key&&(t.stopPropagation(),t.preventDefault())},prepareEventHandlers:function(t){var e=this,n=this[t?"on":"off"],i={click:this.showSuggestions,keydown:function(t){return e.moveSelection(t),e.onAutocomplete(t)},keyup:this.onListKeyUp},o=s({blur:this.onBlur,focus:this.onFocus,input:this.onInput},i);for(var r in o)this.input[n](r,o[r]);var u=t?"addEventListener":"removeEventListener";for(var l in i)this.inputElement[u](l,i[l]);if(!0===this.preventSubmit){var c=this.$el.closest("form");c&&c[u]("keydown",this.onSubmit)}},isScopedSlotEmpty:function(t){if(t){var e=t(this);return!(Array.isArray(e)||e&&(e.tag||e.context||e.text||e.children))}return!0},miscSlotsAreEmpty:function(){var t=this,e=["misc-item-above","misc-item-below"].map(function(e){return t.$scopedSlots[e]});if(e.every(function(t){return!!t}))return e.every(this.isScopedSlotEmpty.bind(this));var n=e.find(function(t){return!!t});return this.isScopedSlotEmpty.call(this,n)},getPropertyByAttribute:function(t,e){return this.isPlainSuggestion?t:void 0!==(void 0===t?"undefined":i(t))?function(t,e){return e.split(".").reduce(function(t,e){return t===Object(t)?t[e]:t},t)}(t,e):t},displayProperty:function(t){return String(this.getPropertyByAttribute(t,this.displayAttribute))},valueProperty:function(t){return this.getPropertyByAttribute(t,this.valueAttribute)},autocompleteText:function(t){this.$emit("input",t),this.inputElement.value=t,this.text=t},select:function(t){this.hovered=null,this.selected=t,this.$emit("select",t),this.autocompleteText(this.displayProperty(t))},hover:function(t,e){this.hovered=t,null!=this.hovered&&this.$emit("hover",t,e)},hoverList:function(t){this.isOverList=t},hideList:function(){this.listShown&&(this.listShown=!1,this.$emit("hide-list"))},showList:function(){this.listShown||this.textLength>=this.minLength&&(this.suggestions.length>0||!this.miscSlotsAreEmpty())&&(this.listShown=!0,this.$emit("show-list"))},showSuggestions:l(function(){var t=this;return c(function(){if(0===t.suggestions.length&&t.minLength===t.textLength)return function(t,e){if(!e)return Promise.resolve(t).then(h)}(t.research())},function(){t.showList()})}),moveSelection:function(t){if(n([this.controlScheme.selectionUp,this.controlScheme.selectionDown],t)){t.preventDefault(),this.showSuggestions();var e=n(this.controlScheme.selectionDown,t),i=2*e-1,s=e?0:this.suggestions.length-1,o=e?this.hoveredIndex<this.suggestions.length-1:this.hoveredIndex>0,r=null;r=this.hovered?o?this.suggestions[this.hoveredIndex+i]:this.suggestions[s]:this.selected||this.suggestions[s],this.hover(r)}},onListKeyUp:function(t){var e=this.controlScheme.select;n([e,this.controlScheme.hideList],t)&&(t.preventDefault(),this.listShown?(n(e,t)&&this.hovered&&this.select(this.hovered),this.hideList()):n(e,t)&&this.research())},onAutocomplete:function(t){n(this.controlScheme.autocomplete,t)&&(t.ctrlKey||t.shiftKey)&&this.suggestions.length>0&&this.suggestions[0]&&this.listShown&&(t.preventDefault(),this.hover(this.suggestions[0]),this.autocompleteText(this.displayProperty(this.suggestions[0])))},suggestionClick:function(t,e){this.$emit("suggestion-click",t,e),this.select(t),this.hideList(),this.isClicking=this.isOverList=!1},onBlur:function(t){var e=this;this.isInFocus?(this.isClicking=this.isOverList&&!this.isTabbed,this.isClicking?t&&t.isTrusted&&!this.isTabbed&&(this.isFalseFocus=!0,this.$nextTick(function(){e.inputElement.focus()})):(this.isInFocus=!1,this.hideList(),this.$emit("blur",t))):(this.inputElement.blur(),console.error("This should never happen!\n If you encouneterd this error, please report at https://github.com/KazanExpress/vue-simple-suggest/issues")),this.isTabbed=!1},onFocus:function(t){this.isInFocus=!0,t&&!this.isFalseFocus&&this.$emit("focus",t),this.isFalseFocus=!1,this.isClicking||this.showSuggestions()},onInput:function(t){var e=t.target?t.target.value:t;this.text!==e&&(this.text=e,this.$emit("input",this.text),this.selected&&(this.selected=null,this.$emit("select",null)),this.debounce?(clearTimeout(this.timeoutInstance),this.timeoutInstance=setTimeout(this.research,this.debounce)):this.research())},research:l(function(){var t=this;return o(function(){return r(function(){return function(t){var e=t();if(e&&e.then)return e.then(h)}(function(){if(t.canSend){t.canSend=!1;var e=t.$set;return u(t.getSuggestions(t.text),function(n){e.call(t,t,"suggestions",n)})}})},function(e){throw t.clearSuggestions(),e})},function(){return t.canSend=!0,0===t.suggestions.length&&t.miscSlotsAreEmpty()?t.hideList():t.showList(),t.suggestions})}),getSuggestions:l(function(t){var e=this;if((t=t||"").length<e.minLength)return e.listShown?(e.hideList(),[]):e.suggestions;e.selected=null,e.listIsRequest&&(e.$emit("request-start",t),(e.suggestions.length>0||!e.miscSlotsAreEmpty())&&e.showList());var n=[];return o(function(){return r(function(){return c(function(){if(e.listIsRequest)return u(e.list(t),function(t){n=t||[]});n=e.list},function(){Array.isArray(n)||(n=[n]),e.isPlainSuggestion="object"!==i(n[0])||Array.isArray(n[0]),e.filterByQuery&&(n=n.filter(function(n){return e.filter(n,t)})),e.listIsRequest&&e.$emit("request-done",n)})},function(t){if(!e.listIsRequest)throw t;e.$emit("request-failed",t)})},function(){return e.maxSuggestions&&n.splice(e.maxSuggestions),n})}),clearSuggestions:function(){this.suggestions.splice(0)}}};return(Vue||window&&window.Vue)&&(Vue||window.Vue).component("vue-simple-suggest",f),f}(); | ||
var VueSimpleSuggest=function(){"use strict";var t={selectionUp:[38],selectionDown:[40],select:[13],hideList:[27],autocomplete:[32,13]},e={input:String,select:Object};function i(t,e){if(t.length<=0)return!1;var i=function(t){return t.some(function(t){return t===e.keyCode})};return Array.isArray(t[0])?t.some(function(t){return i(t)}):i(t)}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t};function o(t,e){try{var i=t()}catch(t){return e()}return i&&i.then?i.then(e,e):e()}function r(t,e){try{var i=t()}catch(t){return e(t)}return i&&i.then?i.then(void 0,e):i}function u(t,e,i){return i?e?e(t):t:(t=Promise.resolve(t),e?t.then(e):t)}var l=function(){try{if(isNaN.apply(null,{}))return function(t){return function(){try{return Promise.resolve(t.apply(this,arguments))}catch(t){return Promise.reject(t)}}}}catch(t){}return function(t){return function(){try{return Promise.resolve(t.apply(this,Array.prototype.slice.call(arguments)))}catch(t){return Promise.reject(t)}}}}();function c(t,e){var i=t();return i&&i.then?i.then(e):e(i)}function h(){}var a={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vue-simple-suggest",class:[t.styles.vueSimpleSuggest,{designed:!t.destyled,focus:t.isInFocus}],on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.isTabbed=!0}}},[i("div",{ref:"inputSlot",staticClass:"input-wrapper",class:t.styles.inputWrapper,attrs:{role:"combobox","aria-haspopup":"listbox","aria-owns":t.listId,"aria-expanded":t.listShown&&!t.removeList?"true":"false"}},[t._t("default",[i("input",t._b({staticClass:"default-input",class:t.styles.defaultInput,domProps:{value:t.text||""}},"input",t.$attrs,!1))])],2),t._v(" "),i("transition",{attrs:{name:"vue-simple-suggest"}},[t.listShown&&!t.removeList?i("ul",{staticClass:"suggestions",class:t.styles.suggestions,attrs:{id:t.listId,role:"listbox","aria-labelledby":t.listId},on:{mouseenter:function(e){t.hoverList(!0)},mouseleave:function(e){t.hoverList(!1)}}},[this.$scopedSlots["misc-item-above"]?i("li",[t._t("misc-item-above",null,{suggestions:t.suggestions,query:t.text})],2):t._e(),t._v(" "),t._l(t.suggestions,function(e,s){return i("li",{key:t.getId(e,s),staticClass:"suggest-item",class:[t.styles.suggestItem,{selected:t.selected&&t.valueProperty(e)==t.valueProperty(t.selected),hover:t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)}],attrs:{role:"option","aria-selected":t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)?"true":"false",id:t.getId(e,s)},on:{mouseenter:function(i){t.hover(e,i.target)},mouseleave:function(e){t.hover(void 0)},click:function(i){t.suggestionClick(e,i)}}},[t._t("suggestion-item",[i("span",[t._v(t._s(t.displayProperty(e)))])],{autocomplete:function(){return t.setText(t.displayProperty(e))},suggestion:e,query:t.text})],2)}),t._v(" "),this.$scopedSlots["misc-item-below"]?i("li",[t._t("misc-item-below",null,{suggestions:t.suggestions,query:t.text})],2):t._e()],2):t._e()])],1)},staticRenderFns:[],name:"vue-simple-suggest",model:{prop:"value",event:"input"},props:{styles:{type:Object,default:function(){return{}}},controls:{type:Object,default:function(){return t}},minLength:{type:Number,default:1},maxSuggestions:{type:Number,default:10},displayAttribute:{type:String,default:"title"},valueAttribute:{type:String,default:"id"},list:{type:[Function,Array],default:function(){return[]}},removeList:{type:Boolean,default:!1},destyled:{type:Boolean,default:!1},preventSubmit:{type:Boolean,default:!0},filterByQuery:{type:Boolean,default:!1},filter:{type:Function,default:function(t,e){return!e||~this.displayProperty(t).toLowerCase().indexOf(e.toLowerCase())}},debounce:{type:Number,default:0},nullableSelect:{type:Boolean,default:!1},value:{},mode:{type:String,default:event,validator:function(t){return!!~Object.keys(e).indexOf(t.toLowerCase())}}},watch:{mode:{handler:function(t,e){var i=this;this.constructor.options.model.event=t,this.$parent?this.$parent.$forceUpdate():(this.$emit("input",this.text),this.$emit("select",this.selected)),this.$nextTick(function(){i.$emit("input",i.text),i.$emit("select",i.selected)})},immediate:!0},value:{handler:function(t){"string"==typeof t?this.text=t:t&&(this.text=this.displayProperty(t))},immediate:!0}},data:function(){return{selected:null,hovered:null,suggestions:[],listShown:!1,inputElement:null,canSend:!0,timeoutInstance:null,text:this.value,isPlainSuggestion:!1,isClicking:!1,isOverList:!1,isInFocus:!1,isFalseFocus:!1,isTabbed:!1,controlScheme:{},listId:this._uid+"-suggestions"}},computed:{listIsRequest:function(){return"function"==typeof this.list},inputIsComponent:function(){return this.$slots.default&&this.$slots.default.length>0&&!!this.$slots.default[0].componentInstance},input:function(){return this.inputIsComponent?this.$slots.default[0].componentInstance:this.inputElement},on:function(){return this.inputIsComponent?"$on":"addEventListener"},off:function(){return this.inputIsComponent?"$off":"removeEventListener"},hoveredIndex:function(){var t=this;return this.suggestions.findIndex(function(e){return t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)})},textLength:function(){return this.text&&this.text.length||this.inputElement.value.length||0},isSelectedUpToDate:function(){return!!this.selected&&this.displayProperty(this.selected)===this.text}},created:function(){this.controlScheme=n({},t,this.controls)},mounted:function(){this.inputElement=this.$refs.inputSlot.querySelector("input"),this.setInputAriaAttributes(),this.prepareEventHandlers(!0)},beforeDestroy:function(){this.prepareEventHandlers(!1)},methods:{onSubmit:function(t){this.preventSubmit&&"Enter"===t.key&&(t.stopPropagation(),t.preventDefault())},setInputAriaAttributes:function(){this.inputElement.setAttribute("aria-activedescendant",""),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls",this.listId)},prepareEventHandlers:function(t){var e=this,i=this[t?"on":"off"],s={click:this.showSuggestions,keydown:function(t){return e.moveSelection(t),e.onAutocomplete(t)},keyup:this.onListKeyUp},o=n({blur:this.onBlur,focus:this.onFocus,input:this.onInput},s);for(var r in o)this.input[i](r,o[r]);var u=t?"addEventListener":"removeEventListener";for(var l in s)this.inputElement[u](l,s[l]);if(!0===this.preventSubmit){var c=this.$el.closest("form");c&&c[u]("keydown",this.onSubmit)}},isScopedSlotEmpty:function(t){if(t){var e=t(this);return!(Array.isArray(e)||e&&(e.tag||e.context||e.text||e.children))}return!0},miscSlotsAreEmpty:function(){var t=this,e=["misc-item-above","misc-item-below"].map(function(e){return t.$scopedSlots[e]});if(e.every(function(t){return!!t}))return e.every(this.isScopedSlotEmpty.bind(this));var i=e.find(function(t){return!!t});return this.isScopedSlotEmpty.call(this,i)},getPropertyByAttribute:function(t,e){return this.isPlainSuggestion?t:void 0!==(void 0===t?"undefined":s(t))?function(t,e){return e.split(".").reduce(function(t,e){return t===Object(t)?t[e]:t},t)}(t,e):t},displayProperty:function(t){return String(this.getPropertyByAttribute(t,this.displayAttribute))},valueProperty:function(t){return this.getPropertyByAttribute(t,this.valueAttribute)},autocompleteText:function(t){this.setText(t)},setText:function(t){var e=this;this.$nextTick(function(){e.$emit("input",t),e.inputElement.value=t,e.text=t})},select:function(t){this.selected=t,this.$emit("select",t),this.hover(null),this.setText(this.displayProperty(t))},hover:function(t,e){this.hovered=t;var i=t?this.getId(t,this.hoveredIndex):"";this.inputElement.setAttribute("aria-activedescendant",i),void 0!==t&&this.$emit("hover",t,e)},hoverList:function(t){this.isOverList=t},hideList:function(){this.listShown&&(this.listShown=!1,this.hover(null),this.$emit("hide-list"))},showList:function(){this.listShown||this.textLength>=this.minLength&&(this.suggestions.length>0||!this.miscSlotsAreEmpty())&&(this.listShown=!0,this.$emit("show-list"))},showSuggestions:l(function(){var t=this;return c(function(){if(0===t.suggestions.length&&t.minLength===t.textLength)return function(t,e){if(!e)return Promise.resolve(t).then(h)}(t.research())},function(){t.showList()})}),moveSelection:function(t){if(this.listShown&&this.suggestions.length&&i([this.controlScheme.selectionUp,this.controlScheme.selectionDown],t)){t.preventDefault(),this.showSuggestions();var e=i(this.controlScheme.selectionDown,t),s=2*e-1,n=e?0:this.suggestions.length-1,o=e?this.hoveredIndex<this.suggestions.length-1:this.hoveredIndex>0,r=null;r=this.hovered?o?this.suggestions[this.hoveredIndex+s]:this.suggestions[n]:this.selected||this.suggestions[n],this.hover(r)}},onListKeyUp:function(t){var e=this.controlScheme.select;i([e,this.controlScheme.hideList],t)&&(t.preventDefault(),this.listShown?(i(e,t)&&(this.nullableSelect||this.hovered)&&this.select(this.hovered),this.hideList()):i(e,t)&&this.research())},onAutocomplete:function(t){i(this.controlScheme.autocomplete,t)&&(t.ctrlKey||t.shiftKey)&&this.suggestions.length>0&&this.suggestions[0]&&this.listShown&&(t.preventDefault(),this.hover(this.suggestions[0]),this.setText(this.displayProperty(this.suggestions[0])))},suggestionClick:function(t,e){var i=this;this.$emit("suggestion-click",t,e),this.select(t),this.isClicking=this.isOverList=!1,this.$nextTick(function(){i.hideList()})},onBlur:function(t){var e=this;this.isInFocus?(this.isClicking=this.isOverList&&!this.isTabbed,this.isClicking?t&&t.isTrusted&&!this.isTabbed&&(this.isFalseFocus=!0,this.$nextTick(function(){e.inputElement.focus()})):(this.isInFocus=!1,this.hideList(),this.$emit("blur",t))):(this.inputElement.blur(),console.error("This should never happen!\n If you encountered this error, please make sure that your input component emits 'focus' events properly.\n For more info see https://github.com/KazanExpress/vue-simple-suggest#custom-input.\n\n If your 'vue-simple-suggest' setup does not include a custom input component - please,\n report to https://github.com/KazanExpress/vue-simple-suggest/issues/new")),this.isTabbed=!1},onFocus:function(t){this.isInFocus=!0,t&&!this.isFalseFocus&&this.$emit("focus",t),this.isFalseFocus=!1,this.isClicking||this.showSuggestions()},onInput:function(t){var e=t.target?t.target.value:t;this.text!==e&&(this.text=e,this.$emit("input",this.text),this.hovered&&this.hover(null),this.debounce?(clearTimeout(this.timeoutInstance),this.timeoutInstance=setTimeout(this.research,this.debounce)):this.research())},research:l(function(){var t=this;return o(function(){return r(function(){return function(t){var e=t();if(e&&e.then)return e.then(h)}(function(){if(t.canSend){t.canSend=!1;var e=t.$set;return u(t.getSuggestions(t.text),function(i){e.call(t,t,"suggestions",i)})}})},function(e){throw t.clearSuggestions(),e})},function(){return t.canSend=!0,0===t.suggestions.length&&t.miscSlotsAreEmpty()?t.hideList():t.showList(),t.suggestions})}),getSuggestions:l(function(t){var e=this;if((t=t||"").length<e.minLength)return e.listShown?(e.hideList(),[]):e.suggestions;e.selected=null,e.listIsRequest&&(e.$emit("request-start",t),(e.suggestions.length>0||!e.miscSlotsAreEmpty())&&e.showList());var i=[];return o(function(){return r(function(){return c(function(){if(e.listIsRequest)return u(e.list(t),function(t){i=t||[]});i=e.list},function(){Array.isArray(i)||(i=[i]),e.isPlainSuggestion="object"!==s(i[0])||Array.isArray(i[0]),e.filterByQuery&&(i=i.filter(function(i){return e.filter(i,t)})),e.listIsRequest&&e.$emit("request-done",i)})},function(t){if(!e.listIsRequest)throw t;e.$emit("request-failed",t)})},function(){return e.maxSuggestions&&i.splice(e.maxSuggestions),i})}),clearSuggestions:function(){this.suggestions.splice(0)},getId:function(t,e){return this.listId+"-suggestion-"+(this.isPlainSuggestion?e:this.valueProperty(t))}}};return(Vue||window&&window.Vue)&&(Vue||window.Vue).component("vue-simple-suggest",a),a}(); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueSimpleSuggest=e()}(this,function(){"use strict";var t={selectionUp:[38],selectionDown:[40],select:[13],hideList:[27],autocomplete:[32,13]},e={input:String,select:Object};function n(t,e){if(t.length<=0)return!1;var n=function(t){return t.some(function(t){return t===e.keyCode})};return Array.isArray(t[0])?t.some(function(t){return n(t)}):n(t)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(t,e){try{var n=t()}catch(t){return e()}return n&&n.then?n.then(e,e):e()}function o(t,e){try{var n=t()}catch(t){return e(t)}return n&&n.then?n.then(void 0,e):n}function r(t,e,n){return n?e?e(t):t:(t=Promise.resolve(t),e?t.then(e):t)}var u=function(){try{if(isNaN.apply(null,{}))return function(t){return function(){try{return Promise.resolve(t.apply(this,arguments))}catch(t){return Promise.reject(t)}}}}catch(t){}return function(t){return function(){try{return Promise.resolve(t.apply(this,Array.prototype.slice.call(arguments)))}catch(t){return Promise.reject(t)}}}}();function l(t,e){var n=t();return n&&n.then?n.then(e):e(n)}function c(){}var h="input",a={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vue-simple-suggest",class:[t.styles.vueSimpleSuggest,{designed:!t.destyled,focus:t.isInFocus}],on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.isTabbed=!0}}},[n("div",{ref:"inputSlot",staticClass:"input-wrapper",class:t.styles.inputWrapper},[t._t("default",[n("input",t._b({staticClass:"default-input",class:t.styles.defaultInput,domProps:{value:t.text||""}},"input",t.$attrs,!1))])],2),t._v(" "),n("transition",{attrs:{name:"vue-simple-suggest"}},[t.listShown&&!t.removeList?n("div",{staticClass:"suggestions",class:t.styles.suggestions,on:{mouseenter:function(e){t.hoverList(!0)},mouseleave:function(e){t.hoverList(!1)}}},[t._t("misc-item-above",null,{suggestions:t.suggestions,query:t.text}),t._v(" "),t._l(t.suggestions,function(e,i){return n("div",{key:t.isPlainSuggestion?"suggestion-"+i:t.valueProperty(e),staticClass:"suggest-item",class:[t.styles.suggestItem,{selected:t.selected&&t.valueProperty(e)==t.valueProperty(t.selected),hover:t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)}],on:{mouseenter:function(n){t.hover(e,n.target)},mouseleave:function(e){t.hover(null,e.target)},click:function(n){t.suggestionClick(e,n)}}},[t._t("suggestion-item",[n("span",[t._v(t._s(t.displayProperty(e)))])],{autocomplete:function(){return t.autocompleteText(t.displayProperty(e))},suggestion:e,query:t.text})],2)}),t._v(" "),t._t("misc-item-below",null,{suggestions:t.suggestions,query:t.text})],2):t._e()])],1)},staticRenderFns:[],name:"vue-simple-suggest",model:{prop:"value",get event(){return h}},props:{styles:{type:Object,default:function(){return{}}},controls:{type:Object,default:function(){return t}},minLength:{type:Number,default:1},maxSuggestions:{type:Number,default:10},displayAttribute:{type:String,default:"title"},valueAttribute:{type:String,default:"id"},list:{type:[Function,Array],default:function(){return[]}},removeList:{type:Boolean,default:!1},destyled:{type:Boolean,default:!1},preventSubmit:{type:Boolean,default:!0},filterByQuery:{type:Boolean,default:!1},filter:{type:Function,default:function(t,e){return!e||~this.displayProperty(t).toLowerCase().indexOf(e.toLowerCase())}},debounce:{type:Number,default:0},value:{},mode:{type:String,default:h,validator:function(t){return!!~Object.keys(e).indexOf(t.toLowerCase())}}},watch:{mode:{handler:function(t,e){h=t},immediate:!0},value:{handler:function(t){this.text=t},immediate:!0}},data:function(){return{selected:null,hovered:null,suggestions:[],listShown:!1,inputElement:null,canSend:!0,timeoutInstance:null,text:this.value,isPlainSuggestion:!1,isClicking:!1,isOverList:!1,isInFocus:!1,isFalseFocus:!1,isTabbed:!1,controlScheme:{}}},computed:{listIsRequest:function(){return"function"==typeof this.list},inputIsComponent:function(){return this.$slots.default&&this.$slots.default.length>0&&!!this.$slots.default[0].componentInstance},input:function(){return this.inputIsComponent?this.$slots.default[0].componentInstance:this.inputElement},on:function(){return this.inputIsComponent?"$on":"addEventListener"},off:function(){return this.inputIsComponent?"$off":"removeEventListener"},hoveredIndex:function(){var t=this;return this.suggestions.findIndex(function(e){return t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)})},textLength:function(){return this.text&&this.text.length||this.inputElement.value.length||0}},created:function(){this.controlScheme=Object.assign({},t,this.controls)},mounted:function(){this.inputElement=this.$refs.inputSlot.querySelector("input"),this.prepareEventHandlers(!0)},beforeDestroy:function(){this.prepareEventHandlers(!1)},methods:{onSubmit:function(t){this.preventSubmit&&"Enter"===t.key&&(t.stopPropagation(),t.preventDefault())},prepareEventHandlers:function(t){var e=this,n=this[t?"on":"off"],i={click:this.showSuggestions,keydown:function(t){return e.moveSelection(t),e.onAutocomplete(t)},keyup:this.onListKeyUp},s=Object.assign({blur:this.onBlur,focus:this.onFocus,input:this.onInput},i);for(var o in s)this.input[n](o,s[o]);var r=t?"addEventListener":"removeEventListener";for(var u in i)this.inputElement[r](u,i[u]);if(!0===this.preventSubmit){var l=this.$el.closest("form");l&&l[r]("keydown",this.onSubmit)}},isScopedSlotEmpty:function(t){if(t){var e=t(this);return!(Array.isArray(e)||e&&(e.tag||e.context||e.text||e.children))}return!0},miscSlotsAreEmpty:function(){var t=this,e=["misc-item-above","misc-item-below"].map(function(e){return t.$scopedSlots[e]});if(e.every(function(t){return!!t}))return e.every(this.isScopedSlotEmpty.bind(this));var n=e.find(function(t){return!!t});return this.isScopedSlotEmpty.call(this,n)},getPropertyByAttribute:function(t,e){return this.isPlainSuggestion?t:void 0!==(void 0===t?"undefined":i(t))?function(t,e){return e.split(".").reduce(function(t,e){return t===Object(t)?t[e]:t},t)}(t,e):t},displayProperty:function(t){return String(this.getPropertyByAttribute(t,this.displayAttribute))},valueProperty:function(t){return this.getPropertyByAttribute(t,this.valueAttribute)},autocompleteText:function(t){this.$emit("input",t),this.inputElement.value=t,this.text=t},select:function(t){this.hovered=null,this.selected=t,this.$emit("select",t),this.autocompleteText(this.displayProperty(t))},hover:function(t,e){this.hovered=t,null!=this.hovered&&this.$emit("hover",t,e)},hoverList:function(t){this.isOverList=t},hideList:function(){this.listShown&&(this.listShown=!1,this.$emit("hide-list"))},showList:function(){this.listShown||this.textLength>=this.minLength&&(this.suggestions.length>0||!this.miscSlotsAreEmpty())&&(this.listShown=!0,this.$emit("show-list"))},showSuggestions:u(function(){var t=this;return l(function(){if(0===t.suggestions.length&&t.minLength===t.textLength)return function(t,e){if(!e)return Promise.resolve(t).then(c)}(t.research())},function(){t.showList()})}),moveSelection:function(t){if(n([this.controlScheme.selectionUp,this.controlScheme.selectionDown],t)){t.preventDefault(),this.showSuggestions();var e=n(this.controlScheme.selectionDown,t),i=2*e-1,s=e?0:this.suggestions.length-1,o=e?this.hoveredIndex<this.suggestions.length-1:this.hoveredIndex>0,r=null;r=this.hovered?o?this.suggestions[this.hoveredIndex+i]:this.suggestions[s]:this.selected||this.suggestions[s],this.hover(r)}},onListKeyUp:function(t){var e=this.controlScheme.select;n([e,this.controlScheme.hideList],t)&&(t.preventDefault(),this.listShown?(n(e,t)&&this.hovered&&this.select(this.hovered),this.hideList()):n(e,t)&&this.research())},onAutocomplete:function(t){n(this.controlScheme.autocomplete,t)&&(t.ctrlKey||t.shiftKey)&&this.suggestions.length>0&&this.suggestions[0]&&this.listShown&&(t.preventDefault(),this.hover(this.suggestions[0]),this.autocompleteText(this.displayProperty(this.suggestions[0])))},suggestionClick:function(t,e){this.$emit("suggestion-click",t,e),this.select(t),this.hideList(),this.isClicking=this.isOverList=!1},onBlur:function(t){var e=this;this.isInFocus?(this.isClicking=this.isOverList&&!this.isTabbed,this.isClicking?t&&t.isTrusted&&!this.isTabbed&&(this.isFalseFocus=!0,this.$nextTick(function(){e.inputElement.focus()})):(this.isInFocus=!1,this.hideList(),this.$emit("blur",t))):(this.inputElement.blur(),console.error("This should never happen!\n If you encouneterd this error, please report at https://github.com/KazanExpress/vue-simple-suggest/issues")),this.isTabbed=!1},onFocus:function(t){this.isInFocus=!0,t&&!this.isFalseFocus&&this.$emit("focus",t),this.isFalseFocus=!1,this.isClicking||this.showSuggestions()},onInput:function(t){var e=t.target?t.target.value:t;this.text!==e&&(this.text=e,this.$emit("input",this.text),this.selected&&(this.selected=null,this.$emit("select",null)),this.debounce?(clearTimeout(this.timeoutInstance),this.timeoutInstance=setTimeout(this.research,this.debounce)):this.research())},research:u(function(){var t=this;return s(function(){return o(function(){return function(t){var e=t();if(e&&e.then)return e.then(c)}(function(){if(t.canSend){t.canSend=!1;var e=t.$set;return r(t.getSuggestions(t.text),function(n){e.call(t,t,"suggestions",n)})}})},function(e){throw t.clearSuggestions(),e})},function(){return t.canSend=!0,0===t.suggestions.length&&t.miscSlotsAreEmpty()?t.hideList():t.showList(),t.suggestions})}),getSuggestions:u(function(t){var e=this;if((t=t||"").length<e.minLength)return e.listShown?(e.hideList(),[]):e.suggestions;e.selected=null,e.listIsRequest&&(e.$emit("request-start",t),(e.suggestions.length>0||!e.miscSlotsAreEmpty())&&e.showList());var n=[];return s(function(){return o(function(){return l(function(){if(e.listIsRequest)return r(e.list(t),function(t){n=t||[]});n=e.list},function(){Array.isArray(n)||(n=[n]),e.isPlainSuggestion="object"!==i(n[0])||Array.isArray(n[0]),e.filterByQuery&&(n=n.filter(function(n){return e.filter(n,t)})),e.listIsRequest&&e.$emit("request-done",n)})},function(t){if(!e.listIsRequest)throw t;e.$emit("request-failed",t)})},function(){return e.maxSuggestions&&n.splice(e.maxSuggestions),n})}),clearSuggestions:function(){this.suggestions.splice(0)}}};return(Vue||window&&window.Vue)&&(Vue||window.Vue).component("vue-simple-suggest",a),a}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueSimpleSuggest=e()}(this,function(){"use strict";var t={selectionUp:[38],selectionDown:[40],select:[13],hideList:[27],autocomplete:[32,13]},e={input:String,select:Object};function i(t,e){if(t.length<=0)return!1;var i=function(t){return t.some(function(t){return t===e.keyCode})};return Array.isArray(t[0])?t.some(function(t){return i(t)}):i(t)}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function n(t,e){try{var i=t()}catch(t){return e()}return i&&i.then?i.then(e,e):e()}function o(t,e){try{var i=t()}catch(t){return e(t)}return i&&i.then?i.then(void 0,e):i}function r(t,e,i){return i?e?e(t):t:(t=Promise.resolve(t),e?t.then(e):t)}var u=function(){try{if(isNaN.apply(null,{}))return function(t){return function(){try{return Promise.resolve(t.apply(this,arguments))}catch(t){return Promise.reject(t)}}}}catch(t){}return function(t){return function(){try{return Promise.resolve(t.apply(this,Array.prototype.slice.call(arguments)))}catch(t){return Promise.reject(t)}}}}();function l(t,e){var i=t();return i&&i.then?i.then(e):e(i)}function c(){}var h={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vue-simple-suggest",class:[t.styles.vueSimpleSuggest,{designed:!t.destyled,focus:t.isInFocus}],on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.isTabbed=!0}}},[i("div",{ref:"inputSlot",staticClass:"input-wrapper",class:t.styles.inputWrapper,attrs:{role:"combobox","aria-haspopup":"listbox","aria-owns":t.listId,"aria-expanded":t.listShown&&!t.removeList?"true":"false"}},[t._t("default",[i("input",t._b({staticClass:"default-input",class:t.styles.defaultInput,domProps:{value:t.text||""}},"input",t.$attrs,!1))])],2),t._v(" "),i("transition",{attrs:{name:"vue-simple-suggest"}},[t.listShown&&!t.removeList?i("ul",{staticClass:"suggestions",class:t.styles.suggestions,attrs:{id:t.listId,role:"listbox","aria-labelledby":t.listId},on:{mouseenter:function(e){t.hoverList(!0)},mouseleave:function(e){t.hoverList(!1)}}},[this.$scopedSlots["misc-item-above"]?i("li",[t._t("misc-item-above",null,{suggestions:t.suggestions,query:t.text})],2):t._e(),t._v(" "),t._l(t.suggestions,function(e,s){return i("li",{key:t.getId(e,s),staticClass:"suggest-item",class:[t.styles.suggestItem,{selected:t.selected&&t.valueProperty(e)==t.valueProperty(t.selected),hover:t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)}],attrs:{role:"option","aria-selected":t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)?"true":"false",id:t.getId(e,s)},on:{mouseenter:function(i){t.hover(e,i.target)},mouseleave:function(e){t.hover(void 0)},click:function(i){t.suggestionClick(e,i)}}},[t._t("suggestion-item",[i("span",[t._v(t._s(t.displayProperty(e)))])],{autocomplete:function(){return t.setText(t.displayProperty(e))},suggestion:e,query:t.text})],2)}),t._v(" "),this.$scopedSlots["misc-item-below"]?i("li",[t._t("misc-item-below",null,{suggestions:t.suggestions,query:t.text})],2):t._e()],2):t._e()])],1)},staticRenderFns:[],name:"vue-simple-suggest",model:{prop:"value",event:"input"},props:{styles:{type:Object,default:function(){return{}}},controls:{type:Object,default:function(){return t}},minLength:{type:Number,default:1},maxSuggestions:{type:Number,default:10},displayAttribute:{type:String,default:"title"},valueAttribute:{type:String,default:"id"},list:{type:[Function,Array],default:function(){return[]}},removeList:{type:Boolean,default:!1},destyled:{type:Boolean,default:!1},preventSubmit:{type:Boolean,default:!0},filterByQuery:{type:Boolean,default:!1},filter:{type:Function,default:function(t,e){return!e||~this.displayProperty(t).toLowerCase().indexOf(e.toLowerCase())}},debounce:{type:Number,default:0},nullableSelect:{type:Boolean,default:!1},value:{},mode:{type:String,default:event,validator:function(t){return!!~Object.keys(e).indexOf(t.toLowerCase())}}},watch:{mode:{handler:function(t,e){var i=this;this.constructor.options.model.event=t,this.$parent?this.$parent.$forceUpdate():(this.$emit("input",this.text),this.$emit("select",this.selected)),this.$nextTick(function(){i.$emit("input",i.text),i.$emit("select",i.selected)})},immediate:!0},value:{handler:function(t){"string"==typeof t?this.text=t:t&&(this.text=this.displayProperty(t))},immediate:!0}},data:function(){return{selected:null,hovered:null,suggestions:[],listShown:!1,inputElement:null,canSend:!0,timeoutInstance:null,text:this.value,isPlainSuggestion:!1,isClicking:!1,isOverList:!1,isInFocus:!1,isFalseFocus:!1,isTabbed:!1,controlScheme:{},listId:this._uid+"-suggestions"}},computed:{listIsRequest:function(){return"function"==typeof this.list},inputIsComponent:function(){return this.$slots.default&&this.$slots.default.length>0&&!!this.$slots.default[0].componentInstance},input:function(){return this.inputIsComponent?this.$slots.default[0].componentInstance:this.inputElement},on:function(){return this.inputIsComponent?"$on":"addEventListener"},off:function(){return this.inputIsComponent?"$off":"removeEventListener"},hoveredIndex:function(){var t=this;return this.suggestions.findIndex(function(e){return t.hovered&&t.valueProperty(t.hovered)==t.valueProperty(e)})},textLength:function(){return this.text&&this.text.length||this.inputElement.value.length||0},isSelectedUpToDate:function(){return!!this.selected&&this.displayProperty(this.selected)===this.text}},created:function(){this.controlScheme=Object.assign({},t,this.controls)},mounted:function(){this.inputElement=this.$refs.inputSlot.querySelector("input"),this.setInputAriaAttributes(),this.prepareEventHandlers(!0)},beforeDestroy:function(){this.prepareEventHandlers(!1)},methods:{onSubmit:function(t){this.preventSubmit&&"Enter"===t.key&&(t.stopPropagation(),t.preventDefault())},setInputAriaAttributes:function(){this.inputElement.setAttribute("aria-activedescendant",""),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls",this.listId)},prepareEventHandlers:function(t){var e=this,i=this[t?"on":"off"],s={click:this.showSuggestions,keydown:function(t){return e.moveSelection(t),e.onAutocomplete(t)},keyup:this.onListKeyUp},n=Object.assign({blur:this.onBlur,focus:this.onFocus,input:this.onInput},s);for(var o in n)this.input[i](o,n[o]);var r=t?"addEventListener":"removeEventListener";for(var u in s)this.inputElement[r](u,s[u]);if(!0===this.preventSubmit){var l=this.$el.closest("form");l&&l[r]("keydown",this.onSubmit)}},isScopedSlotEmpty:function(t){if(t){var e=t(this);return!(Array.isArray(e)||e&&(e.tag||e.context||e.text||e.children))}return!0},miscSlotsAreEmpty:function(){var t=this,e=["misc-item-above","misc-item-below"].map(function(e){return t.$scopedSlots[e]});if(e.every(function(t){return!!t}))return e.every(this.isScopedSlotEmpty.bind(this));var i=e.find(function(t){return!!t});return this.isScopedSlotEmpty.call(this,i)},getPropertyByAttribute:function(t,e){return this.isPlainSuggestion?t:void 0!==(void 0===t?"undefined":s(t))?function(t,e){return e.split(".").reduce(function(t,e){return t===Object(t)?t[e]:t},t)}(t,e):t},displayProperty:function(t){return String(this.getPropertyByAttribute(t,this.displayAttribute))},valueProperty:function(t){return this.getPropertyByAttribute(t,this.valueAttribute)},autocompleteText:function(t){this.setText(t)},setText:function(t){var e=this;this.$nextTick(function(){e.$emit("input",t),e.inputElement.value=t,e.text=t})},select:function(t){this.selected=t,this.$emit("select",t),this.hover(null),this.setText(this.displayProperty(t))},hover:function(t,e){this.hovered=t;var i=t?this.getId(t,this.hoveredIndex):"";this.inputElement.setAttribute("aria-activedescendant",i),void 0!==t&&this.$emit("hover",t,e)},hoverList:function(t){this.isOverList=t},hideList:function(){this.listShown&&(this.listShown=!1,this.hover(null),this.$emit("hide-list"))},showList:function(){this.listShown||this.textLength>=this.minLength&&(this.suggestions.length>0||!this.miscSlotsAreEmpty())&&(this.listShown=!0,this.$emit("show-list"))},showSuggestions:u(function(){var t=this;return l(function(){if(0===t.suggestions.length&&t.minLength===t.textLength)return function(t,e){if(!e)return Promise.resolve(t).then(c)}(t.research())},function(){t.showList()})}),moveSelection:function(t){if(this.listShown&&this.suggestions.length&&i([this.controlScheme.selectionUp,this.controlScheme.selectionDown],t)){t.preventDefault(),this.showSuggestions();var e=i(this.controlScheme.selectionDown,t),s=2*e-1,n=e?0:this.suggestions.length-1,o=e?this.hoveredIndex<this.suggestions.length-1:this.hoveredIndex>0,r=null;r=this.hovered?o?this.suggestions[this.hoveredIndex+s]:this.suggestions[n]:this.selected||this.suggestions[n],this.hover(r)}},onListKeyUp:function(t){var e=this.controlScheme.select;i([e,this.controlScheme.hideList],t)&&(t.preventDefault(),this.listShown?(i(e,t)&&(this.nullableSelect||this.hovered)&&this.select(this.hovered),this.hideList()):i(e,t)&&this.research())},onAutocomplete:function(t){i(this.controlScheme.autocomplete,t)&&(t.ctrlKey||t.shiftKey)&&this.suggestions.length>0&&this.suggestions[0]&&this.listShown&&(t.preventDefault(),this.hover(this.suggestions[0]),this.setText(this.displayProperty(this.suggestions[0])))},suggestionClick:function(t,e){var i=this;this.$emit("suggestion-click",t,e),this.select(t),this.isClicking=this.isOverList=!1,this.$nextTick(function(){i.hideList()})},onBlur:function(t){var e=this;this.isInFocus?(this.isClicking=this.isOverList&&!this.isTabbed,this.isClicking?t&&t.isTrusted&&!this.isTabbed&&(this.isFalseFocus=!0,this.$nextTick(function(){e.inputElement.focus()})):(this.isInFocus=!1,this.hideList(),this.$emit("blur",t))):(this.inputElement.blur(),console.error("This should never happen!\n If you encountered this error, please make sure that your input component emits 'focus' events properly.\n For more info see https://github.com/KazanExpress/vue-simple-suggest#custom-input.\n\n If your 'vue-simple-suggest' setup does not include a custom input component - please,\n report to https://github.com/KazanExpress/vue-simple-suggest/issues/new")),this.isTabbed=!1},onFocus:function(t){this.isInFocus=!0,t&&!this.isFalseFocus&&this.$emit("focus",t),this.isFalseFocus=!1,this.isClicking||this.showSuggestions()},onInput:function(t){var e=t.target?t.target.value:t;this.text!==e&&(this.text=e,this.$emit("input",this.text),this.hovered&&this.hover(null),this.debounce?(clearTimeout(this.timeoutInstance),this.timeoutInstance=setTimeout(this.research,this.debounce)):this.research())},research:u(function(){var t=this;return n(function(){return o(function(){return function(t){var e=t();if(e&&e.then)return e.then(c)}(function(){if(t.canSend){t.canSend=!1;var e=t.$set;return r(t.getSuggestions(t.text),function(i){e.call(t,t,"suggestions",i)})}})},function(e){throw t.clearSuggestions(),e})},function(){return t.canSend=!0,0===t.suggestions.length&&t.miscSlotsAreEmpty()?t.hideList():t.showList(),t.suggestions})}),getSuggestions:u(function(t){var e=this;if((t=t||"").length<e.minLength)return e.listShown?(e.hideList(),[]):e.suggestions;e.selected=null,e.listIsRequest&&(e.$emit("request-start",t),(e.suggestions.length>0||!e.miscSlotsAreEmpty())&&e.showList());var i=[];return n(function(){return o(function(){return l(function(){if(e.listIsRequest)return r(e.list(t),function(t){i=t||[]});i=e.list},function(){Array.isArray(i)||(i=[i]),e.isPlainSuggestion="object"!==s(i[0])||Array.isArray(i[0]),e.filterByQuery&&(i=i.filter(function(i){return e.filter(i,t)})),e.listIsRequest&&e.$emit("request-done",i)})},function(t){if(!e.listIsRequest)throw t;e.$emit("request-failed",t)})},function(){return e.maxSuggestions&&i.splice(e.maxSuggestions),i})}),clearSuggestions:function(){this.suggestions.splice(0)},getId:function(t,e){return this.listId+"-suggestion-"+(this.isPlainSuggestion?e:this.valueProperty(t))}}};return(Vue||window&&window.Vue)&&(Vue||window.Vue).component("vue-simple-suggest",h),h}); |
@@ -15,14 +15,14 @@ export const defaultControls = { | ||
export function fromPath(obj, path) { | ||
return path.split('.').reduce((o, i) => (o === Object(o) ? o[i] : o), obj); | ||
return path.split('.').reduce((o, i) => (o === Object(o) ? o[i] : o), obj) | ||
} | ||
export function hasKeyCode(arr, event) { | ||
if (arr.length <= 0) return false; | ||
if (arr.length <= 0) return false | ||
const has = arr => arr.some(code => code === event.keyCode); | ||
const has = arr => arr.some(code => code === event.keyCode) | ||
if (Array.isArray(arr[0])) { | ||
return arr.some(array => has(array)); | ||
return arr.some(array => has(array)) | ||
} else { | ||
return has(arr); | ||
return has(arr) | ||
} | ||
} |
{ | ||
"name": "vue-simple-suggest", | ||
"description": "Feature-rich autocomplete component for Vue.js", | ||
"version": "1.8.3", | ||
"version": "1.9.0", | ||
"author": "KazanExpress", | ||
@@ -32,2 +32,8 @@ "license": "MIT", | ||
"Suggestion", | ||
"Autosuggest", | ||
"WAI-ARIA", | ||
"aria-spec", | ||
"aria", | ||
"aria-attributes", | ||
"aria-autocomplete", | ||
"REST", | ||
@@ -47,2 +53,4 @@ "Search", | ||
"config-less", | ||
"zero-configuration", | ||
"versatile", | ||
"JavaScript", | ||
@@ -60,2 +68,3 @@ "JS" | ||
"devDependencies": { | ||
"all-contributors-cli": "^6.2.0", | ||
"babel-core": "^6.26.3", | ||
@@ -62,0 +71,0 @@ "babel-loader": "^7.1.4", |
@@ -6,6 +6,8 @@ # vue-simple-suggest | ||
[![npm](https://img.shields.io/npm/v/vue-simple-suggest.svg?style=flat-square)](https://www.npmjs.com/package/vue-simple-suggest) | ||
[![live demo](https://img.shields.io/badge/demo-live-brightgreen.svg?style=flat-square)](https://kazanexpress.github.io/vue-simple-suggest/) | ||
[![](https://img.shields.io/badge/github-repo-lightgray.svg?style=flat-square)](https://github.com/KazanExpress/vue-simple-suggest) | ||
[![](https://img.shields.io/badge/very-awesome-orange.svg?style=flat-square)](https://github.com/vuejs/awesome-vue#autocomplete) [![npm](https://img.shields.io/npm/dt/vue-simple-suggest.svg?style=flat-square)](https://www.npmjs.com/package/vue-simple-suggest) | ||
[![npm](https://img.shields.io/npm/v/vue-simple-suggest.svg?style=flat-square)](https://www.npmjs.com/package/vue-simple-suggest "NPM package page") | ||
[![live demo](https://img.shields.io/badge/demo-live-brightgreen.svg?style=flat-square)](https://kazanexpress.github.io/vue-simple-suggest/ "Live playground") | ||
[![github repo](https://img.shields.io/badge/github-repo-lightgray.svg?style=flat-square)](https://github.com/KazanExpress/vue-simple-suggest "GitHub repository") | ||
[![vue-awesome link](https://img.shields.io/badge/very-awesome-orange.svg?style=flat-square)](https://github.com/vuejs/awesome-vue#autocomplete "Our section at the vue-awesome repository") | ||
[![npm](https://img.shields.io/npm/dm/vue-simple-suggest.svg?style=flat-square)](https://www.npmjs.com/package/vue-simple-suggest "Downloads per month") | ||
[![All Contributors](https://img.shields.io/badge/contributors-18-blueviolet.svg?style=flat-square)](#contributors "Our awesome contributors!") | ||
@@ -50,4 +52,6 @@ ## Install | ||
- [Custom input](#custom-input) | ||
- [Accessibility on custom input](#accessibility-on-custom-input) | ||
- [Custom suggestion item](#custom-suggestion-item) | ||
- [Custom miscellanious item slots](#custom-miscellanious-item-slots) | ||
- [Contributors](#contributors) | ||
@@ -70,2 +74,3 @@ | ||
- `v-model` support. | ||
- Automatic [accessibility attributes](#accessibility-on-custom-input) (WAI-ARIA complete) | ||
- Switching `v-model` type (select/input). | ||
@@ -185,3 +190,3 @@ - [Custom input](#custom-input) element through default slot. | ||
/// CommonJS (async, Object.assign and promises are polyfilled) | ||
/// CommonJS (async, arrow-functions and promises are polyfilled) | ||
const VueSimpleSuggest = require('vue-simple-suggest') | ||
@@ -407,3 +412,3 @@ // or, if you have problems importing: | ||
#### Transitions | ||
> New in v1.8.0 | ||
> New in [v1.8.0](https://github.com/KazanExpress/vue-simple-suggest/releases/tag/v1.8.0) | ||
@@ -455,2 +460,3 @@ You can also define custom list transitions by defining css rules for the transition named `vue-simple-suggest` on the `.suggestions` div: | ||
| `prevent-submit` <sup>v1.8.1</sup> | Boolean | `true` | Whether to prevent form submitting when `Enter` key is pressed. | | ||
| `nullable-select` <sup>[v1.9.0](https://github.com/KazanExpress/vue-simple-suggest/releases/tag/v1.4.0)</sup> | Boolean | `false` | Whether the `select` should accept `null` or not. | | ||
@@ -482,3 +488,3 @@ ##### mode | ||
| `select` | Selected suggestion | Fires on suggestion selection (via a mouse click or enter keypress). | | ||
| `hover` | Hovered suggestion | Fires each time a new suggestion is highlighted (via a cursor movement or keyboard arrows). | | ||
| `hover` | Hovered suggestion, target element | Fires each time a new suggestion is highlighted (via a cursor movement or keyboard arrows). | | ||
| `suggestion-click` | Selected suggestion, HTML click event | Fires on suggestion element click. | | ||
@@ -507,2 +513,3 @@ | `show-list` | - | Fires each time the suggestion list is toggled to be shown. | | ||
|`valueProperty`| suggestion | Returns the value property of a suggestion. | | ||
|`setText` <sup>v1.9.0</sup> | text | Reliably sets custom text to the input field. | | ||
@@ -551,2 +558,3 @@ ----- | ||
|`isTabbed`| `false` | `true` if the user pressed tab, while the component is in focus. | | ||
|`isSelectedUpToDate`| `false` | `true` if the user hasn't done any inputs since the last selection, so the selection is still relevant. | | ||
@@ -623,2 +631,18 @@ ----- | ||
##### Accessibility on custom input | ||
> New in [v1.9.0](https://github.com/KazanExpress/vue-simple-suggest/releases/tag/v1.9.0) | ||
`vue-simple-suggest` automatically injects 3 necessary ARIA attributes for the default `<input>` element | ||
and any custom input, as long as your custom input component contains an html `<input>` element. | ||
These attributes ensure that the autocomplete can be used by users who rely on Screen Readers. | ||
| Name | Value | Description | | ||
|-----------------------|------------------------------------|----------------------------------------| | ||
| aria-autocomplete | `"list"` | Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup. | | ||
| aria-controls | IDREF of `suggestions` list | IDREF of the popup element that lists suggested values. | | ||
| aria-activedescendant | IDREF of hovered option | Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element. | | ||
##### Custom suggestion item | ||
@@ -757,1 +781,13 @@ > `suggestion-item` slot (optional) | ||
``` | ||
## Contributors | ||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore --> | ||
<table><tr><td align="center"><a href="https://github.com/Raiondesu"><img src="https://avatars3.githubusercontent.com/u/19854420?v=4" width="100px;" alt="Alexey"/><br /><sub><b>Alexey</b></sub></a><br /><a href="#creator-Raiondesu" title="Original creator">๐</a></td><td align="center"><a href="https://github.com/kaskar2008"><img src="https://avatars3.githubusercontent.com/u/6456858?v=4" width="100px;" alt="Karen"/><br /><sub><b>Karen</b></sub></a><br /><a href="#creator-pokerface-kaskar2008" title="Original creator">๐</a></td><td align="center"><a href="http://simeon.fyi"><img src="https://avatars3.githubusercontent.com/u/28311328?v=4" width="100px;" alt="Simeon Kerkola"/><br /><sub><b>Simeon Kerkola</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=sssmi" title="Code">๐ป</a> <a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=sssmi" title="Documentation">๐</a> <a href="#ideas-sssmi" title="Ideas, Planning, & Feedback">๐ค</a></td><td align="center"><a href="https://github.com/rcostalenz"><img src="https://avatars0.githubusercontent.com/u/4765136?v=4" width="100px;" alt="Roberson Costa"/><br /><sub><b>Roberson Costa</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=rcostalenz" title="Code">๐ป</a> <a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=rcostalenz" title="Documentation">๐</a> <a href="#ideas-rcostalenz" title="Ideas, Planning, & Feedback">๐ค</a></td><td align="center"><a href="https://github.com/rosdi"><img src="https://avatars2.githubusercontent.com/u/5094028?v=4" width="100px;" alt="Rosdi Kasim"/><br /><sub><b>Rosdi Kasim</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=rosdi" title="Documentation">๐</a></td><td align="center"><a href="https://github.com/antoinematyja"><img src="https://avatars2.githubusercontent.com/u/9961462?v=4" width="100px;" alt="antoinematyja"/><br /><sub><b>antoinematyja</b></sub></a><br /><a href="#ideas-antoinematyja" title="Ideas, Planning, & Feedback">๐ค</a></td><td align="center"><a href="http://www.contoweb.ch/"><img src="https://avatars1.githubusercontent.com/u/24254923?v=4" width="100px;" alt="Matthias Martin"/><br /><sub><b>Matthias Martin</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Amatthiascw" title="Bug reports">๐</a></td></tr><tr><td align="center"><a href="http://robjbrain.com"><img src="https://avatars0.githubusercontent.com/u/10143910?v=4" width="100px;" alt="Rob Brain"/><br /><sub><b>Rob Brain</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Arobjbrain" title="Bug reports">๐</a> <a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Arobjbrain" title="Bug reports">๐</a></td><td align="center"><a href="https://github.com/MrWook"><img src="https://avatars1.githubusercontent.com/u/20294042?v=4" width="100px;" alt="MrWook"/><br /><sub><b>MrWook</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3AMrWook" title="Bug reports">๐</a></td><td align="center"><a href="https://github.com/nattam"><img src="https://avatars3.githubusercontent.com/u/19463672?v=4" width="100px;" alt="nattam"/><br /><sub><b>nattam</b></sub></a><br /><a href="#ideas-nattam" title="Ideas, Planning, & Feedback">๐ค</a></td><td align="center"><a href="https://github.com/petyunchik"><img src="https://avatars1.githubusercontent.com/u/673497?v=4" width="100px;" alt="Petr"/><br /><sub><b>Petr</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Apetyunchik" title="Bug reports">๐</a></td><td align="center"><a href="https://github.com/RMFogarty"><img src="https://avatars0.githubusercontent.com/u/10094132?v=4" width="100px;" alt="RMFogarty"/><br /><sub><b>RMFogarty</b></sub></a><br /><a href="#question-RMFogarty" title="Answering Questions">๐ฌ</a></td><td align="center"><a href="https://brickgale.github.io"><img src="https://avatars3.githubusercontent.com/u/6366161?v=4" width="100px;" alt="Brian Monsales"/><br /><sub><b>Brian Monsales</b></sub></a><br /><a href="#question-brickgale" title="Answering Questions">๐ฌ</a></td><td align="center"><a href="http://www.mila76.it"><img src="https://avatars3.githubusercontent.com/u/378500?v=4" width="100px;" alt="Mila76"/><br /><sub><b>Mila76</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Amila76" title="Bug reports">๐</a></td></tr><tr><td align="center"><a href="https://github.com/Lofbergio"><img src="https://avatars3.githubusercontent.com/u/1188259?v=4" width="100px;" alt="Andriy Lรถfberg"/><br /><sub><b>Andriy Lรถfberg</b></sub></a><br /><a href="#question-Lofbergio" title="Answering Questions">๐ฌ</a> <a href="#ideas-Lofbergio" title="Ideas, Planning, & Feedback">๐ค</a></td><td align="center"><a href="http://buno.com.br"><img src="https://avatars3.githubusercontent.com/u/5221494?v=4" width="100px;" alt="Bruno Monteiro"/><br /><sub><b>Bruno Monteiro</b></sub></a><br /><a href="#ideas-bunomonteiro" title="Ideas, Planning, & Feedback">๐ค</a></td><td align="center"><a href="https://github.com/hannesaasamets"><img src="https://avatars1.githubusercontent.com/u/20644595?v=4" width="100px;" alt="hannesaasamets"/><br /><sub><b>hannesaasamets</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Ahannesaasamets" title="Bug reports">๐</a></td><td align="center"><a href="https://github.com/Geminii"><img src="https://avatars1.githubusercontent.com/u/9429420?v=4" width="100px;" alt="Jimmy"/><br /><sub><b>Jimmy</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3AGeminii" title="Bug reports">๐</a></td><td align="center"><a href="http://www.lastmileretail.com"><img src="https://avatars0.githubusercontent.com/u/10226784?v=4" width="100px;" alt="Will Plaehn"/><br /><sub><b>Will Plaehn</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=willplaehn" title="Code">๐ป</a> <a href="#ideas-willplaehn" title="Ideas, Planning, & Feedback">๐ค</a> <a href="https://github.com/KazanExpress/vue-simple-suggest/commits?author=willplaehn" title="Documentation">๐</a></td><td align="center"><a href="https://github.com/lauri911"><img src="https://avatars2.githubusercontent.com/u/12371449?v=4" width="100px;" alt="lauri911"/><br /><sub><b>lauri911</b></sub></a><br /><a href="https://github.com/KazanExpress/vue-simple-suggest/issues?q=author%3Alauri911" title="Bug reports">๐</a></td></tr></table> | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome! |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
176544
20
2027
0
783
34