Differential D19191 Diff 45965 webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js
Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js
/** | /** | ||||
* @requires javelin-install | * @requires javelin-install | ||||
* javelin-util | * javelin-util | ||||
* javelin-dom | * javelin-dom | ||||
* javelin-typeahead-normalizer | * javelin-typeahead-normalizer | ||||
* @provides javelin-typeahead-source | * @provides javelin-typeahead-source | ||||
* @javelin | * @javelin | ||||
*/ | */ | ||||
JX.install('TypeaheadSource', { | JX.install('TypeaheadSource', { | ||||
construct : function() { | construct : function() { | ||||
this._raw = {}; | this.resetResults(); | ||||
this._lookup = {}; | |||||
this.setNormalizer(JX.TypeaheadNormalizer.normalize); | this.setNormalizer(JX.TypeaheadNormalizer.normalize); | ||||
this._excludeIDs = {}; | this._excludeIDs = {}; | ||||
}, | }, | ||||
events : ['waiting', 'resultsready', 'complete'], | events : ['waiting', 'resultsready', 'complete'], | ||||
properties : { | properties : { | ||||
▲ Show 20 Lines • Show All 332 Lines • ▼ Show 20 Lines | members : { | ||||
}, | }, | ||||
tokenize : function(str) { | tokenize : function(str) { | ||||
str = this.normalize(str); | str = this.normalize(str); | ||||
if (!str.length) { | if (!str.length) { | ||||
return []; | return []; | ||||
} | } | ||||
return str.split(/\s+/g); | return str.split(/\s+/g); | ||||
}, | }, | ||||
resetResults: function() { | |||||
this._raw = {}; | |||||
this._lookup = {}; | |||||
}, | |||||
_defaultTransformer : function(object) { | _defaultTransformer : function(object) { | ||||
return { | return { | ||||
name : object[0], | name : object[0], | ||||
display : object[0], | display : object[0], | ||||
uri : object[1], | uri : object[1], | ||||
id : object[2] | id : object[2] | ||||
}; | }; | ||||
} | } | ||||
} | } | ||||
}); | }); |