Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I made 0.11.3 with fix and implemented some features #1630

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
6 changes: 3 additions & 3 deletions dist/bloodhound.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 0.11.3
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2017 Twitter, Inc. and other contributors; Licensed MIT
*/

(function(root, factory) {
Expand Down Expand Up @@ -151,7 +151,7 @@
noop: function() {}
};
}();
var VERSION = "0.11.1";
var VERSION = "0.11.3";
var tokenizers = function() {
"use strict";
return {
Expand Down
6 changes: 3 additions & 3 deletions dist/bloodhound.min.js

Large diffs are not rendered by default.

32 changes: 22 additions & 10 deletions dist/typeahead.bundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 0.11.3
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2017 Twitter, Inc. and other contributors; Licensed MIT
*/

(function(root, factory) {
Expand Down Expand Up @@ -151,7 +151,7 @@
noop: function() {}
};
}();
var VERSION = "0.11.1";
var VERSION = "0.11.3";
var tokenizers = function() {
"use strict";
return {
Expand Down Expand Up @@ -1720,8 +1720,8 @@
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
rendered += suggestions.length;
that.async && that.trigger("asyncReceived", query);
}
}
Expand Down Expand Up @@ -1834,6 +1834,7 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
Expand Down Expand Up @@ -2010,6 +2011,7 @@
},
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
this.eventBus.trigger("clear");
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
this._updateHint();
Expand Down Expand Up @@ -2057,12 +2059,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
Expand Down Expand Up @@ -2099,6 +2101,9 @@
this.input.clearHint();
}
},
clearHint: function clearHint() {
this.input.clearHint();
},
isEnabled: function isEnabled() {
return this.enabled;
},
Expand Down Expand Up @@ -2154,8 +2159,9 @@
}
return !this.isOpen();
},
setVal: function setVal(val) {
this.input.setQuery(_.toStr(val));
setVal: function setVal(val, silent) {
this.input.setQuery(_.toStr(val), silent);
this.eventBus.trigger("inputchange");
},
getVal: function getVal() {
return this.input.getQuery();
Expand Down Expand Up @@ -2354,7 +2360,7 @@
});
return success;
},
val: function val(newVal) {
val: function val(newVal, silent) {
var query;
if (!arguments.length) {
ttEach(this.first(), function(t) {
Expand All @@ -2363,11 +2369,17 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal), silent);
});
return this;
}
},
clearHint: function clearHint() {
ttEach(this, function(t) {
t.clearHint();
});
return this;
},
destroy: function destroy() {
ttEach(this, function(typeahead, $input) {
revert($input);
Expand Down
8 changes: 4 additions & 4 deletions dist/typeahead.bundle.min.js

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions dist/typeahead.jquery.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 0.11.3
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2017 Twitter, Inc. and other contributors; Licensed MIT
*/

(function(root, factory) {
Expand Down Expand Up @@ -807,8 +807,8 @@
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
rendered += suggestions.length;
that.async && that.trigger("asyncReceived", query);
}
}
Expand Down Expand Up @@ -921,6 +921,7 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
Expand Down Expand Up @@ -1097,6 +1098,7 @@
},
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
this.eventBus.trigger("clear");
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
this._updateHint();
Expand Down Expand Up @@ -1144,12 +1146,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
Expand Down Expand Up @@ -1186,6 +1188,9 @@
this.input.clearHint();
}
},
clearHint: function clearHint() {
this.input.clearHint();
},
isEnabled: function isEnabled() {
return this.enabled;
},
Expand Down Expand Up @@ -1241,8 +1246,9 @@
}
return !this.isOpen();
},
setVal: function setVal(val) {
this.input.setQuery(_.toStr(val));
setVal: function setVal(val, silent) {
this.input.setQuery(_.toStr(val), silent);
this.eventBus.trigger("inputchange");
},
getVal: function getVal() {
return this.input.getQuery();
Expand Down Expand Up @@ -1441,7 +1447,7 @@
});
return success;
},
val: function val(newVal) {
val: function val(newVal, silent) {
var query;
if (!arguments.length) {
ttEach(this.first(), function(t) {
Expand All @@ -1450,11 +1456,17 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal), silent);
});
return this;
}
},
clearHint: function clearHint() {
ttEach(this, function(t) {
t.clearHint();
});
return this;
},
destroy: function destroy() {
ttEach(this, function(typeahead, $input) {
revert($input);
Expand Down
6 changes: 3 additions & 3 deletions dist/typeahead.jquery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
"scripts": {
"test": "./node_modules/karma/bin/karma start --single-run --browsers PhantomJS"
},
"version": "0.11.1",
"version": "0.11.3",
"main": "dist/typeahead.bundle.js"
}
2 changes: 1 addition & 1 deletion src/typeahead/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ var Dataset = (function() {
// do not render the suggestions as they've become outdated
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
rendered += suggestions.length;

that.async && that.trigger('asyncReceived', query);
}
Expand Down
1 change: 1 addition & 0 deletions src/typeahead/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ var Menu = (function() {
},

open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},

Expand Down
9 changes: 7 additions & 2 deletions src/typeahead/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@

// mirror jQuery#val functionality: reads opearte on first match,
// write operates on all matches
val: function val(newVal) {
val: function val(newVal,silent) {
var query;

if (!arguments.length) {
Expand All @@ -170,11 +170,16 @@
}

else {
ttEach(this, function(t) { t.setVal(newVal); });
ttEach(this, function(t) { t.setVal(_.toStr(newVal),silent); });
return this;
}
},

clearHint: function clearHint() {
ttEach(this, function(t) {t.clearHint();});
return this;
},

destroy: function destroy() {
ttEach(this, function(typeahead, $input) {
revert($input);
Expand Down
16 changes: 11 additions & 5 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ var Typeahead = (function() {
},

_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
this._updateHint();
this.eventBus.trigger('clear');
},

_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
Expand Down Expand Up @@ -192,13 +193,13 @@ var Typeahead = (function() {

_onLeftKeyed: function onLeftKeyed() {
if (this.dir === 'rtl' && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},

_onRightKeyed: function onRightKeyed() {
if (this.dir === 'ltr' && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},

Expand Down Expand Up @@ -255,6 +256,10 @@ var Typeahead = (function() {

// ### public

clearHint: function clearHint() {
this.input.clearHint();
},

isEnabled: function isEnabled() {
return this.enabled;
},
Expand Down Expand Up @@ -335,9 +340,10 @@ var Typeahead = (function() {
return !this.isOpen();
},

setVal: function setVal(val) {
setVal: function setVal(val,silent) {
// expect val to be a string, so be safe, and coerce
this.input.setQuery(_.toStr(val));
this.input.setQuery(_.toStr(val),silent);
this.eventBus.trigger('inputchange');
},

getVal: function getVal() {
Expand Down
2 changes: 1 addition & 1 deletion typeahead.js.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
"url": "https://twitter.com/vskarich"
}
],
"version": "0.11.1"
"version": "0.11.3"
}