Skip to content

Commit c52f05b

Browse files
committed
Update AlphaNum keyboard mapping to close autocomplete when currentValue is empty/too small
1 parent 289f7ce commit c52f05b

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

dist/autocomplete.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var EventType;
2525
* @class
2626
* @author Baptiste Donaux <baptiste.donaux@gmail.com> @baptistedonaux
2727
*/
28-
var AutoComplete = (function () {
28+
var AutoComplete = /** @class */ (function () {
2929
// Constructor
3030
function AutoComplete(params, selector) {
3131
if (params === void 0) { params = {}; }
@@ -284,6 +284,9 @@ var AutoComplete = (function () {
284284
this._Open();
285285
}.bind(this));
286286
}
287+
else {
288+
this._Close();
289+
}
287290
},
288291
Operator: ConditionOperator.AND,
289292
Event: EventType.KEYUP
@@ -367,7 +370,7 @@ var AutoComplete = (function () {
367370
_Blur: function (now) {
368371
if (now === void 0) { now = false; }
369372
if (now) {
370-
this.DOMResults.setAttribute("class", "autocomplete");
373+
this._Close();
371374
}
372375
else {
373376
var params = this;
@@ -404,6 +407,9 @@ var AutoComplete = (function () {
404407
}
405408
});
406409
},
410+
_Close: function () {
411+
this.DOMResults.setAttribute("class", "autocomplete");
412+
},
407413
/**
408414
* Position the results HTML element
409415
*/

dist/autocomplete.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/autocomplete.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface Params {
3939
_Limit: any;
4040
_MinChars: any;
4141
_Open: any;
42+
_Close: any;
4243
_Position: any;
4344
_Post: any;
4445
_Pre: any;
@@ -224,6 +225,8 @@ class AutoComplete {
224225
this._Open();
225226
}.bind(this)
226227
);
228+
} else {
229+
this._Close();
227230
}
228231
},
229232
Operator: ConditionOperator.AND,
@@ -326,7 +329,7 @@ class AutoComplete {
326329
*/
327330
_Blur: function(now: boolean = false): void {
328331
if (now) {
329-
this.DOMResults.setAttribute("class", "autocomplete");
332+
this._Close();
330333
} else {
331334
var params = this;
332335
setTimeout(function() {
@@ -367,6 +370,10 @@ class AutoComplete {
367370
});
368371
},
369372

373+
_Close: function(): void {
374+
this.DOMResults.setAttribute("class", "autocomplete");
375+
},
376+
370377
/**
371378
* Position the results HTML element
372379
*/

0 commit comments

Comments
 (0)