2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-22 12:55:12 +00:00

Rev for 1.2.25 release

This commit is contained in:
Tomas Kirda 2016-06-14 16:17:00 -05:00
parent 3f53453499
commit 95a329d80d
5 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "devbridge-autocomplete", "name": "devbridge-autocomplete",
"version": "1.2.24", "version": "1.2.25",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete", "homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"authors": [ "authors": [
"Tomas Kirda" "Tomas Kirda"

View File

@ -6,7 +6,7 @@
"ajax", "ajax",
"autocomplete" "autocomplete"
], ],
"version": "1.2.24", "version": "1.2.25",
"author": { "author": {
"name": "Tomas Kirda", "name": "Tomas Kirda",
"url": "https://github.com/tkirda" "url": "https://github.com/tkirda"

View File

@ -1,5 +1,5 @@
/** /**
* Ajax Autocomplete for jQuery, version 1.2.24 * Ajax Autocomplete for jQuery, version 1.2.25
* (c) 2015 Tomas Kirda * (c) 2015 Tomas Kirda
* *
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@ -127,6 +127,11 @@
$.Autocomplete = Autocomplete; $.Autocomplete = Autocomplete;
Autocomplete.formatResult = function (suggestion, currentValue) { Autocomplete.formatResult = function (suggestion, currentValue) {
// Do not replace anything if there current value is empty
if (!currentValue) {
return suggestion.value;
}
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value return suggestion.value
@ -188,6 +193,7 @@
// Listen for click event on suggestions list: // Listen for click event on suggestions list:
container.on('click.autocomplete', suggestionSelector, function () { container.on('click.autocomplete', suggestionSelector, function () {
that.select($(this).data('index')); that.select($(this).data('index'));
return false;
}); });
that.fixPositionCapture = function () { that.fixPositionCapture = function () {
@ -208,8 +214,10 @@
onFocus: function () { onFocus: function () {
var that = this; var that = this;
that.fixPosition(); that.fixPosition();
if (that.options.minChars === 0 && that.el.val().length === 0) {
if (that.el.val().length >= that.options.minChars) {
that.onValueChange(); that.onValueChange();
} }
}, },
@ -672,7 +680,7 @@
html += formatGroup(suggestion, value, i); html += formatGroup(suggestion, value, i);
} }
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>'; html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
}); });
this.adjustContainerWidth(); this.adjustContainerWidth();
@ -681,7 +689,7 @@
container.html(html); container.html(html);
if ($.isFunction(beforeRender)) { if ($.isFunction(beforeRender)) {
beforeRender.call(that.element, container, that.sugestions); beforeRender.call(that.element, container, that.suggestions);
} }
that.fixPosition(); that.fixPosition();

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "devbridge-autocomplete", "name": "devbridge-autocomplete",
"version": "1.2.24", "version": "1.2.25",
"description": "Autocomplete provides suggestions while you type into the text field.", "description": "Autocomplete provides suggestions while you type into the text field.",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete", "homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"author": "Tomas Kirda (https://twitter.com/tkirda)", "author": "Tomas Kirda (https://twitter.com/tkirda)",