/**
Typeahead.js input, based on [Twitter Typeahead](http://twitter.github.io/typeahead.js).
It is mainly replacement of typeahead in Bootstrap 3.
@class typeaheadjs
@extends text
@since 1.5.0
@final
@example
**/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('typeaheadjs', options, Constructor.defaults);
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.text);
$.extend(Constructor.prototype, {
render: function() {
this.renderClear();
this.setClass();
this.setAttr('placeholder');
this.$input.typeahead(this.options.typeahead);
// copy `input-sm | input-lg` classes to placeholder input
if($.fn.editableform.engine === 'bs3') {
if(this.$input.hasClass('input-sm')) {
this.$input.siblings('input.tt-hint').addClass('input-sm');
}
if(this.$input.hasClass('input-lg')) {
this.$input.siblings('input.tt-hint').addClass('input-lg');
}
}
}
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default
**/
tpl:'',
/**
Configuration of typeahead itself.
[Full list of options](https://github.com/twitter/typeahead.js#dataset).
@property typeahead
@type object
@default null
**/
typeahead: null,
/**
Whether to show `clear` button
@property clear
@type boolean
@default true
**/
clear: true
});
$.fn.editabletypes.typeaheadjs = Constructor;
}(window.jQuery));