ax5ui-combobox
Advanced tools
Comparing version 0.3.1 to 0.3.2
75
API.md
@@ -20,3 +20,2 @@ ## Classes | ||
**Kind**: global class | ||
**Version**: 0.1.6 | ||
**Author:** tom@axisj.com | ||
@@ -29,6 +28,9 @@ | ||
* [.update(item)](#ax5combobox.update) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.val(boundID, [value], [Selected])](#ax5combobox.val) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.setValue(_boundID, _value, [_selected])](#ax5combobox.setValue) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.setText(_boundID, _text, [_selected])](#ax5combobox.setText) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.getSelectedOption(_boundID)](#ax5combobox.getSelectedOption) ⇒ <code>Array</code> | ||
* [.close()](#ax5combobox.close) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.enable(boundID)](#ax5combobox.enable) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.disable(boundID)](#ax5combobox.disable) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.blur(_boundID)](#ax5combobox.blur) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.enable(_boundID)](#ax5combobox.enable) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
* [.disable(_boundID)](#ax5combobox.disable) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
@@ -86,5 +88,5 @@ <a name="ax5combobox.setConfig"></a> | ||
<a name="ax5combobox.val"></a> | ||
<a name="ax5combobox.setValue"></a> | ||
### ax5combobox.val(boundID, [value], [Selected]) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
### ax5combobox.setValue(_boundID, _value, [_selected]) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
@@ -94,6 +96,36 @@ | ||
| --- | --- | | ||
| boundID | <code>String</code> | <code>Number</code> | <code>Element</code> | | ||
| [value] | <code>String</code> | <code>Object</code> | <code>Array</code> | | ||
| [Selected] | <code>Boolean</code> | | ||
| _boundID | <code>jQueryObject</code> | <code>Element</code> | <code>Number</code> | | ||
| _value | <code>String</code> | <code>Array</code> | | ||
| [_selected] | <code>Boolean</code> | | ||
**Example** | ||
```js | ||
myCombo.setValue($('[data-ax5combobox="combo1"]'), "1"); | ||
myCombo.setValue($('[data-ax5combobox="combo1"]'), ["1", "2"]); | ||
``` | ||
<a name="ax5combobox.setText"></a> | ||
### ax5combobox.setText(_boundID, _text, [_selected]) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
| Param | Type | | ||
| --- | --- | | ||
| _boundID | <code>jQueryObject</code> | <code>Element</code> | <code>Number</code> | | ||
| _text | <code>String</code> | <code>Array</code> | | ||
| [_selected] | <code>Boolean</code> | | ||
**Example** | ||
```js | ||
myCombo.setText($('[data-ax5combobox="combo1"]'), "string"); | ||
myCombo.setText($('[data-ax5combobox="combo1"]'), ["substring", "search"]); | ||
``` | ||
<a name="ax5combobox.getSelectedOption"></a> | ||
### ax5combobox.getSelectedOption(_boundID) ⇒ <code>Array</code> | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
| Param | Type | | ||
| --- | --- | | ||
| _boundID | <code>jQueryObject</code> | <code>Element</code> | <code>Number</code> | | ||
<a name="ax5combobox.close"></a> | ||
@@ -103,19 +135,28 @@ | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
<a name="ax5combobox.blur"></a> | ||
### ax5combobox.blur(_boundID) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
| Param | Type | | ||
| --- | --- | | ||
| _boundID | <code>jQueryObject</code> | <code>Element</code> | <code>Number</code> | | ||
<a name="ax5combobox.enable"></a> | ||
### ax5combobox.enable(boundID) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
### ax5combobox.enable(_boundID) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
| Param | | ||
| --- | | ||
| boundID | | ||
| Param | Type | | ||
| --- | --- | | ||
| _boundID | <code>jQueryObject</code> | <code>Element</code> | <code>Number</code> | | ||
<a name="ax5combobox.disable"></a> | ||
### ax5combobox.disable(boundID) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
### ax5combobox.disable(_boundID) ⇒ <code>[ax5combobox](#ax5combobox)</code> | ||
**Kind**: static method of <code>[ax5combobox](#ax5combobox)</code> | ||
| Param | | ||
| --- | | ||
| boundID | | ||
| Param | Type | | ||
| --- | --- | | ||
| _boundID | <code>jQueryObject</code> | <code>Element</code> | <code>Number</code> | | ||
@@ -122,0 +163,0 @@ <a name="jQueryExtends"></a> |
{ | ||
"name": "ax5ui-combobox", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "A combobox plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,1 +0,1 @@ | ||
"use strict";!function(){var e,t=ax5.ui,o=ax5.util;t.addClass({className:"combobox",version:"0.3.1"},function(){var t=function(){var t,i=this;this.instanceId=ax5.getGuid(),this.config={theme:"default",animateTime:250,removeIcon:"X",lang:{noSelected:"",noOptions:"no options",loading:"now loading.."},columnKeys:{optionValue:"value",optionText:"text",optionSelected:"selected"}},this.queue=[],this.activecomboboxOptionGroup=null,this.activecomboboxQueueIndex=-1,this.openTimer=null,this.closeTimer=null,this.waitOptionsCallback=null,this.keyUpTimer=null,t=this.config;var n=function(e,t){return e&&e.onStateChanged?e.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),"changeValue"==t.state&&(e&&e.onChange?e.onChange.call(t,t):this.onChange&&this.onChange.call(t,t)),e=null,t=null,!0},s=function(){for(var e,t=this.queue.length;t--;){var i=this.queue[t];if(i.$display&&(e=Math.max(i.$select.outerWidth(),o.number(i.minWidth)),i.$display.css({"min-width":e}),i.reset&&i.$display.find(".addon-icon-reset").css({"line-height":this.queue[t].$display.height()+"px"}),i.multiple)){var n=function(){return o.number(i.$display.css("border-top-width"))+o.number(i.$display.css("border-bottom-width"))}.call(this);i.$target.height(""),i.$display.height("");var s=i.$displayTable.outerHeight();Math.abs(s-i.$target.height())>n&&(i.$target.css({height:s+n}),i.$display.css({height:s+n}))}}return t=null,e=null,this},a=function(e){if(!this.activecomboboxOptionGroup)return this;var t=this.queue[this.activecomboboxQueueIndex],o={},i={};e&&jQuery(document.body).append(this.activecomboboxOptionGroup),o=t.$target.offset(),i={width:t.$target.outerWidth(),height:t.$target.outerHeight()},t.direction&&""!==t.direction&&"auto"!==t.direction||(t.direction="top"),e&&this.activecomboboxOptionGroup.addClass("direction-"+t.direction),this.activecomboboxOptionGroup.css(function(){return"top"==t.direction?{left:o.left,top:o.top+i.height+1,width:i.width}:"bottom"==t.direction?{left:o.left,top:o.top-this.activecomboboxOptionGroup.outerHeight()-1,width:i.width}:void 0}.call(this))},l=function(e,t){if(!this.activecomboboxOptionGroup)return this;var i=this.queue[this.activecomboboxQueueIndex],n="display";return(t=o.findParentNode(e.target,function(e){return e.getAttribute("data-option-value")?(n="optionItem",!0):i.$target.get(0)==e?(n="display",!0):void 0}))?("optionItem"===n&&($.call(this,i.id,{index:{gindex:t.getAttribute("data-option-group-index"),index:t.getAttribute("data-option-index")}},void 0,"internal"),o.selectRange(i.$displayLabel,"end"),i.multiple||this.close()),this):(this.close(),this)},c=function(t){if(t.keyCode==ax5.info.eventKeys.ESC)this.close();else if(t.which==ax5.info.eventKeys.RETURN){for(var o=[],i=this.queue[this.activecomboboxQueueIndex],n=i.$displayLabel.get(0).childNodes,s=0,a=n.length;a>s;s++){var l=n[s];if(l.nodeType in e.util.nodeTypeProcessor){var c=e.util.nodeTypeProcessor[l.nodeType].call(this,this.activecomboboxQueueIndex,l);"undefined"!=typeof c&&o.push(c)}}$.call(this,i.id,o,!0),r.call(this,this.activecomboboxQueueIndex),i.multiple||this.close()}},u=function(t){var o=this.queue[t],i={};return i.id=o.id,i.theme=o.theme,i.size="ax5combobox-option-group-"+o.size,i.multiple=o.multiple,i.lang=o.lang,i.options=o.options,i.selected=o.selected,i.hasSelected=i.selected&&i.selected.length>0,i.removeIcon=o.removeIcon,ax5.mustache.render(e.tmpl.label.call(this,o.columnKeys),i)+" "},d=function(e){var t,i=this.queue[e];if(i.$displayLabel.html(u.call(this,e)),i.$target.height(""),i.$display.height(""),i.$target.height()<(t=i.$displayTable.outerHeight())){var n=function(){return o.number(i.$display.css("border-top-width"))+o.number(i.$display.css("border-bottom-width"))}();i.$target.css({height:t+n}),i.$display.css({height:t+n})}},r=function(e){this.queue[e].$displayLabel.trigger("focus"),o.selectRange(this.queue[e].$displayLabel,"end")},p=function(e){this.queue[e].$displayLabel.trigger("blur")},h=function(e,t){this.queue[e].waitOptions=!0,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(getOptionsTmpl.call(this,this.queue[e].columnKeys),this.queue[e]))),this.queue[e].onSearch.call({self:this,item:this.queue[e],searchWord:t},function(e){var t={},i=this.queue[this.activecomboboxQueueIndex];return i?(function(e,t){var i={};t.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),o.isArray(e.selected)&&e.selected.forEach(function(o){i[o[e.columnKeys.optionValue]]&&(t.options[i[o[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(i,e),i.options=f.call(this,this.activecomboboxQueueIndex,e.options),s.call(this),t.id=i.id,t.theme=i.theme,t.size="ax5combobox-option-group-"+i.size,t.multiple=i.multiple,t.lang=i.lang,t.options=i.options,void this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(getOptionsTmpl.call(this,i.columnKeys),t)))):!1}.bind(this))},x=function(e,t){if(-1==this.activecomboboxQueueIndex)return this;var o,i=[],n=-1,s=this.queue[e].indexedOptions.length-1;if(""!=t){var a=/[\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]/gi;if(t=t.replace(a,""),this.queue[e].onSearch){h.call(this,e,t);try{return i}finally{i=null,n=null,s=null,o=null}}for(;s-n++;){if(o=this.queue[e].indexedOptions[n],(""+o.text).toLowerCase()==t.toLowerCase()){i=[{"@findex":o["@findex"],optionsSort:0}];break}var l=(""+o.text).toLowerCase().search(t.toLowerCase());if(l>-1&&(i.push({"@findex":o["@findex"],optionsSort:l}),i.length>2))break;l=null}i.sort(function(e,t){return e.optionsSort-t.optionsSort})}i&&i.length>0?m.call(this,e,void 0,i[0]["@findex"]):b.call(this,e);try{return i}finally{i=null,n=null,s=null,o=null}},b=function(e){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover").removeAttr("data-option-selected"),this.queue[e].optionFocusIndex=-1},m=function(e,t,i){var n,s,a,l,c=this.queue[e];if(this.activecomboboxOptionGroup&&c.options&&c.options.length>0){if("undefined"!=typeof i?n=i:(s=-1==c.optionFocusIndex?c.optionSelectedIndex||-1:c.optionFocusIndex,-1==s?n=0:(n=s+t,0>n?n=0:n>c.optionItemLength-1&&(n=c.optionItemLength-1))),c.optionFocusIndex=n,c.options[n]&&c.options[n].hide){if("undefined"==typeof t)return this;for(;c.options[n].hide;){if(n+=t,0>n){n=0;break}if(n>c.optionItemLength-1){n=c.optionItemLength-1;break}}}if("undefined"!=typeof n&&(this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover"),a=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+n+'"]').addClass("hover"),l=this.activecomboboxOptionGroup.find('[data-els="content"]'),a.get(0))){var u=a.outerHeight(),d=l.innerHeight(),r=l.scrollTop(),p=a.position().top+l.scrollTop();if(p+u>d+r?l.scrollTop(p+u-d):r>p&&l.scrollTop(p),"undefined"!=typeof t){var h=c.$displayLabel.get(0).childNodes,x=h[h.length-1];x&&"3"==x.nodeType?(x.nodeValue=c.indexedOptions[n].text,o.selectRange(c.$displayLabel,"end")):x&&"1"==x.nodeType&&(jQuery(x).after(c.indexedOptions[n].text),o.selectRange(c.$displayLabel,"end"))}}}},f=function(){var e=function(e,t){t?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected=[]};return function(t,n){var s,a,l,c=this.queue[t],u=0;return e.call(this,t,!1),n?(c.options=n,c.indexedOptions=[],s=[],s.push('<option value=""></option>'),c.options.forEach(function(o,n){o.optgroup?(o["@gindex"]=n,o.options.forEach(function(o,a){o["@index"]=a,o["@findex"]=u,s.push('<option value="'+o[c.columnKeys.optionValue]+'" '+(o[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+o[c.columnKeys.optionText]+"</option>"),o[c.columnKeys.optionSelected]&&e.call(i,t,o),c.indexedOptions.push({"@gindex":n,"@index":a,"@findex":u,value:o[c.columnKeys.optionValue],text:o[c.columnKeys.optionText]}),u++})):(o["@index"]=n,o["@findex"]=u,s.push('<option value="'+o[c.columnKeys.optionValue]+'" '+(o[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+o[c.columnKeys.optionText]+"</option>"),o[c.columnKeys.optionSelected]&&e.call(i,t,o),c.indexedOptions.push({"@index":n,"@findex":u,value:o[c.columnKeys.optionValue],text:o[c.columnKeys.optionText]}),u++)}),c.optionItemLength=u,c.$select.html(s.join(""))):(c.$select.get(0).options&&c.$select.get(0).options.length&&(c.$select.get(0).options[0].selected=!1),a=o.toArray(c.$select.get(0).options),l=[],a.forEach(function(o,n){var s={};s[c.columnKeys.optionValue]=o.value,s[c.columnKeys.optionText]=o.text,s[c.columnKeys.optionSelected]=o.selected,s["@index"]=n,s["@findex"]=u,o.selected&&e.call(i,t,s),l.push(s),u++,s=null}),c.options=l,c.indexedOptions=l,c.$select.prepend('<option value=""></option>'),c.$select.get(0).options[0].selected=!0),s=null,a=null,l=null,c.options}}(),v=function(e){return e instanceof jQuery?e=e.data("data-ax5combobox-id"):o.isString(e)||(e=jQuery(e).data("data-ax5combobox-id")),o.isString(e)?o.search(this.queue,function(){return this.id==e}):void console.log(ax5.info.getError("ax5combobox","402","getQueIdx"))},g=function(e,t,o){return"undefined"==typeof o?e.multiple?!t:!0:o},y=function(e){this.queue[e].options.forEach(function(e){e.optgroup?e.options.forEach(function(e){e.selected=!1}):e.selected=!1})},$=function(){var e={index:function(e,t,n,s){var l=this.queue[e];o.isString(t.index.gindex)?"undefined"!=typeof l.options[t.index.gindex]&&(l.options[t.index.gindex].options[t.index.index][l.columnKeys.optionSelected]=g(l,l.options[t.index.gindex].options[t.index.index][l.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-group-index="'+t.index.gindex+'"][data-option-index="'+t.index.index+'"]').attr("data-option-Selected",l.options[t.index.gindex].options[t.index.index][l.columnKeys.optionSelected].toString())):"undefined"!=typeof l.options[t.index.index]&&(l.options[t.index.index][l.columnKeys.optionSelected]=g(l,l.options[t.index.index][l.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-index="'+t.index.index+'"]').attr("data-option-Selected",l.options[t.index.index][l.columnKeys.optionSelected].toString())),("undefined"==typeof s||"justSetValue"!==s)&&(f.call(this,e,l.options),d.call(this,e),a.call(this))},arr:function(t,n,s,l){n.forEach(function(n){if(o.isString(n)||o.isNumber(n))e.text.call(i,t,n,s,"justSetValue");else for(var a in e)if(n[a]){e[a].call(i,t,n,s,"justSetValue");break}}),f.call(this,t,this.queue[t].options),d.call(this,t),a.call(this)},value:function(e,t,i,n){var s,l=this.queue[e],c=o.search(l.options,function(){return this[l.columnKeys.optionValue]==t[l.columnKeys.optionValue]});c>-1?l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i):(c=l.options.length,s={"@index":c,hide:!0,addedOption:!0},s[l.columnKeys.optionValue]=t,s[l.columnKeys.optionText]=t,l.options.push(s),l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i)),("undefined"==typeof n||"justSetValue"!==n)&&(f.call(this,e,this.queue[e].options),d.call(this,e),a.call(this))},text:function(e,t,i,n){var s,l=this.queue[e],c=o.search(l.options,function(){return this[l.columnKeys.optionText]==t});c>-1?l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i):(c=l.options.length,s={"@index":c,hide:!0,addedOption:!0},s[l.columnKeys.optionValue]=t,s[l.columnKeys.optionText]=t,l.options.push(s),l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i)),("undefined"==typeof n||"justSetValue"!==n)&&(f.call(this,e,this.queue[e].options),d.call(this,e),a.call(this))},clear:function(e){y.call(this,e),f.call(this,e,this.queue[e].options),r.call(this,e),b.call(this,e),this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-index]").attr("data-option-Selected","false"),this.queue[e].optionSelectedIndex=-1}};return function(t,i,s,a){var l=o.isNumber(t)?t:v.call(this,t);if(-1===l)return void console.log(ax5.info.getError("ax5combobox","402","val"));if("undefined"==typeof i)throw"error not found value";if(o.isArray(i))e.clear.call(this,l),e.arr.call(this,l,this.queue[l].multiple||0==i.length?i:[i[i.length-1]],s);else if(o.isString(i)||o.isNumber(i))"undefined"==typeof i||null===i||this.queue[l].multiple||y.call(this,l),e.text.call(this,l,i,s),d.call(this,l);else if(null===i)e.clear.call(this,l),d.call(this,l);else{this.queue[l].multiple||y.call(this,l);for(var c in e)if(i[c]){e[c].call(this,l,i,s);break}d.call(this,l)}return"undefined"!=typeof i&&a&&!a.noStateChange&&n.call(this,this.queue[l],{self:this,item:this.queue[l],state:"changeValue",value:this.queue[l].selected}),t=null,this}}();this.init=function(){this.onStateChanged=t.onStateChanged,this.onChange=t.onChange,jQuery(window).bind("resize.ax5combobox-display-"+this.instanceId,function(){s.call(this)}.bind(this))},this.bind=function(n){var a,l=function(){var t=o.debounce(function(t){if(-1==this.activecomboboxQueueIndex)return this;for(var n=[],s="",a=this.queue[t],l=a.$displayLabel.get(0).childNodes,c=0,u=l.length;u>c;c++){var d=l[c];if(d.nodeType in e.util.nodeTypeProcessor){var r=e.util.nodeTypeProcessor[d.nodeType].call(this,this.activecomboboxQueueIndex,d,!0);"undefined"==typeof r||(o.isString(r)?(s=r,"1"==d.nodeType&&d.getAttribute("data-ax5combobox-selected-text")?s=!1:n.push(r)):n.push(r))}}0==l.length?$.call(this,a.id,null,void 0,"internal"):s===!1?($.call(this,a.id,null,void 0,"internal"),$.call(this,a.id,n,void 0,"internal"),o.selectRange(a.$displayLabel,"end")):""!=s&&x.call(i,t,s)},150),n=function(t){for(var i,n=[],s=this.queue[t],a=s.$displayLabel.get(0).childNodes,l=0,c=a.length;c>l;l++){var u=a[l];if(u.nodeType in e.util.nodeTypeProcessor){var d=e.util.nodeTypeProcessor[u.nodeType].call(this,t,u,!0);"undefined"==typeof d||(o.isString(d)?(i=d,n.push(d)):n.push(d))}}"undefined"!=typeof i&&$.call(this,s.id,n,void 0,"internal")},a={click:function(e,t){var n,s=o.findParentNode(t.target,function(e){return e.getAttribute("data-ax5combobox-remove")?(n="optionItemRemove",!0):e.getAttribute("data-selected-clear")?(n="clear",!0):void 0});if(s){if("optionItemRemove"===n){var a=s.getAttribute("data-ax5combobox-remove-index"),l=this.queue[e].selected[a];return $.call(this,e,{index:{gindex:l["@gindex"],index:l["@index"]}},!1,!0),r.call(this,this.activecomboboxQueueIndex),o.stopEvent(t),this}"clear"===n&&$.call(this,e,{clear:!0})}else i.activecomboboxQueueIndex==e?-1==this.queue[e].optionFocusIndex&&i.close():(i.open(e),""==this.queue[e].$displayLabel.text().replace(/^\W*|\W*$/g,"")&&(this.queue[e].$displayLabel.html(u.call(this,e)),r.call(this,e)))},keyUp:function(e,n){return n.which==ax5.info.eventKeys.ESC&&-1===i.activecomboboxQueueIndex?(o.stopEvent(n),this):(i.activecomboboxQueueIndex!=e&&(i.open(e),o.stopEvent(n)),void t.call(this,e))},keyDown:function(e,t){t.which==ax5.info.eventKeys.ESC?o.stopEvent(t):t.which==ax5.info.eventKeys.RETURN?o.stopEvent(t):t.which==ax5.info.eventKeys.DOWN?(m.call(this,e,1),o.stopEvent(t)):t.which==ax5.info.eventKeys.UP&&(m.call(this,e,-1),o.stopEvent(t))},focus:function(e,t){},blur:function(e,t){n.call(this,e),o.stopEvent(t)},selectChange:function(e,t){$.call(this,e,{value:this.queue[e].$select.val()},!0)}};return function(t){var o=this.queue[t],i={};return o.selected=[],o.$display?(o.$displayLabel.html(u.call(this,t)),o.options=f.call(this,t,o.options),s.call(this)):(i.instanceId=this.instanceId,i.id=o.id,i.name=o.name,i.theme=o.theme,i.tabIndex=o.tabIndex,i.multiple=o.multiple,i.reset=o.reset,i.label=u.call(this,t),i.formSize=function(){return o.size?"input-"+o.size:""}(),o.$display=jQuery(ax5.mustache.render(e.tmpl.comboboxDisplay.call(this,t),i)),o.$displayTable=o.$display.find('[data-els="display-table"]'),o.$displayLabel=o.$display.find('[data-ax5combobox-display="label"]'),o.$target.find("select").get(0)?(o.$select=o.$target.find("select"),o.$select.attr("tabindex","-1").attr("class","form-control "+i.formSize),i.name&&o.$select.attr("name","name"),i.multiple&&o.$select.attr("multiple","multiple")):(o.$select=jQuery(ax5.mustache.render(e.tmpl.formSelect.call(this,t),i)),o.$target.append(o.$select)),o.$target.append(o.$display),o.options=f.call(this,t,o.options),s.call(this)),o.$display.unbind("click.ax5combobox").bind("click.ax5combobox",a.click.bind(this,t)),o.$displayLabel.unbind("focus.ax5combobox").bind("focus.ax5combobox",a.focus.bind(this,t)).unbind("blur.ax5combobox").bind("blur.ax5combobox",a.blur.bind(this,t)).unbind("keyup.ax5combobox").bind("keyup.ax5combobox",a.keyUp.bind(this,t)).unbind("keydown.ax5combobox").bind("keydown.ax5combobox",a.keyDown.bind(this,t)),o.$select.unbind("change.ax5combobox").bind("change.ax5combobox",a.selectChange.bind(this,t)),i=null,o=null,t=null,this}}(),c={};return n=jQuery.extend(!0,c,t,n),n.target?(n.$target=jQuery(n.target),n.id||(n.id=n.$target.data("data-ax5combobox-id")),n.id||(n.id="ax5combobox-"+ax5.getGuid(),n.$target.data("data-ax5combobox-id",n.id)),n.name=n.$target.attr("data-ax5combobox"),n.options&&(n.options=JSON.parse(JSON.stringify(n.options))),function(e){o.isObject(e)&&!e.error&&(n=jQuery.extend(!0,n,e))}(o.parseJson(n.$target.attr("data-ax5combobox-config"),!0)),a=o.search(this.queue,function(){return this.id==n.id}),-1===a?(this.queue.push(n),l.call(this,this.queue.length-1)):(this.queue[a]=jQuery.extend(!0,{},this.queue[a],n),l.call(this,a)),c=null,a=null,this):(console.log(ax5.info.getError("ax5combobox","401","bind")),this)},this.open=function(){var i=function(t){t.onExpand.call({self:this,item:t},function(t){if(this.waitOptionsCallback){var i={},n=this.queue[this.activecomboboxQueueIndex];!function(e,t){var i={};t.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),o.isArray(e.selected)&&e.selected.forEach(function(o){i[o[e.columnKeys.optionValue]]&&(t.options[i[o[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(n,t),n.$display.find('[data-ax5combobox-display="label"]').html(u.call(this,this.activecomboboxQueueIndex)),n.options=f.call(this,this.activecomboboxQueueIndex,t.options),s.call(this),i.id=n.id,i.theme=n.theme,i.size="ax5combobox-option-group-"+n.size,i.multiple=n.multiple,i.lang=n.lang,i.options=n.options,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(e.tmpl.options.call(this,n.columnKeys),i)))}}.bind(this))};return function(s,u){this.waitOptionsCallback=null;var d,r,p=o.isNumber(s)?s:v.call(this,s),h=this.queue[p],x={};return h.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activecomboboxOptionGroup?this.activecomboboxQueueIndex==p?this:u>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(p,(u||0)+1)}.bind(this),t.animateTime),this):(h.optionFocusIndex=-1,h.selected&&h.selected.length>0&&(h.optionSelectedIndex=h.selected[0]["@findex"]),x.id=h.id,x.theme=h.theme,x.size="ax5combobox-option-group-"+h.size,x.multiple=h.multiple,x.lang=h.lang,h.$display.attr("data-combobox-option-group-opened","true"),h.onExpand&&(x.waitOptions=!0),x.options=o.filter(h.options,function(){return!this.hide}),this.activecomboboxOptionGroup=jQuery(ax5.mustache.render(e.tmpl.optionGroup.call(this,h.columnKeys),x)),this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(e.tmpl.options.call(this,h.columnKeys),x))),this.activecomboboxQueueIndex=p,a.call(this,"append"),jQuery(window).bind("resize.ax5combobox-"+this.instanceId,function(){a.call(this)}.bind(this)),h.selected&&h.selected.length>0&&(r=this.activecomboboxOptionGroup.find('[data-option-index="'+h.selected[0]["@index"]+'"]'),r.get(0)&&(d=r.position().top-this.activecomboboxOptionGroup.height()/3,this.activecomboboxOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:d},h.animateTime,"swing",function(){}))),jQuery(window).bind("keyup.ax5combobox-"+this.instanceId,function(e){e=e||window.event,c.call(this,e),o.stopEvent(e)}.bind(this)),jQuery(window).bind("click.ax5combobox-"+this.instanceId,function(e){e=e||window.event,l.call(this,e),o.stopEvent(e)}.bind(this)),n.call(this,h,{self:this,state:"open",item:h}),h.onExpand&&(this.waitOptionsCallback=!0,i.call(this,h)),x=null,d=null,r=null,this))}}(),this.update=function(e){return this.bind(e),this},this.setValue=function(e,t,i){var n=o.isNumber(e)?e:v.call(this,e);if(-1===n)return void console.log(ax5.info.getError("ax5combobox","402","val"));if(y.call(this,n),o.isArray(t)){var s=o.map(t,function(){return{value:this}});$.call(this,n,s,i||!0,{noStateChange:!0})}else(o.isString(t)||o.isNumber(t))&&$.call(this,n,{value:t},i||!0,{noStateChange:!0});return p.call(this,n),this},this.setText=function(e,t,i){var n=o.isNumber(e)?e:v.call(this,e);return-1===n?void console.log(ax5.info.getError("ax5combobox","402","val")):(y.call(this,n),$.call(this,n,t,!0,{noStateChange:!0}),p.call(this,n),this)},this.getSelectedOption=function(e){var t=o.isNumber(e)?e:v.call(this,e);return-1===t?void console.log(ax5.info.getError("ax5combobox","402","val")):o.deepCopy(this.queue[t].selected)},this.close=function(e){return this.closeTimer&&clearTimeout(this.closeTimer),this.activecomboboxOptionGroup?(e=this.queue[this.activecomboboxQueueIndex],e.optionFocusIndex=-1,e.$display.removeAttr("data-combobox-option-group-opened").trigger("focus"),this.activecomboboxOptionGroup.addClass("destroy"),jQuery(window).unbind("resize.ax5combobox-"+this.instanceId).unbind("click.ax5combobox-"+this.instanceId).unbind("keyup.ax5combobox-"+this.instanceId),this.closeTimer=setTimeout(function(){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.remove(),this.activecomboboxOptionGroup=null,this.activecomboboxQueueIndex=-1,n.call(this,e,{self:this,state:"close"})}.bind(this),t.animateTime),this.waitOptionsCallback=null,this):this},this.blur=function(e){var t=o.isNumber(e)?e:v.call(this,e);return-1===t?void console.log(ax5.info.getError("ax5combobox","402","val")):(p.call(this,t),this)},this.enable=function(e){var t=v.call(this,e);return this.queue[t].$display.removeAttr("disabled"),this.queue[t].$input.removeAttr("disabled"),n.call(this,this.queue[t],{self:this,state:"enable"}),this},this.disable=function(e){var t=v.call(this,e);return this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$input.attr("disabled","disabled"),n.call(this,this.queue[t],{self:this,state:"disable"}),this},this.main=function(){arguments&&o.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)};return t}()),e=ax5.ui.combobox}(),ax5.ui.combobox_instance=new ax5.ui.combobox,jQuery.fn.ax5combobox=function(){return function(e){if(ax5.util.isString(arguments[0])){var t=arguments[0];switch(t){case"open":return ax5.ui.combobox_instance.open(this);case"close":return ax5.ui.combobox_instance.close(this);case"setValue":return ax5.ui.combobox_instance.setValue(this,arguments[1],arguments[2],arguments[3],arguments[4]||"justSetValue");case"setText":return ax5.ui.combobox_instance.setText(this,arguments[1],arguments[2],arguments[3],arguments[4]||"justSetValue");case"getSelectedOption":return ax5.ui.combobox_instance.getSelectedOption(this);case"enable":return ax5.ui.combobox_instance.enable(this);case"disable":return ax5.ui.combobox_instance.disable(this);case"blur":return ax5.ui.combobox_instance.blur(this);default:return this}}else"undefined"==typeof e&&(e={}),jQuery.each(this,function(){var t={target:this};e=jQuery.extend({},e,t),ax5.ui.combobox_instance.bind(e)});return this}}(),function(){var e=ax5.ui.combobox,t=(ax5.util,function(e){return'\n<div class="ax5combobox-option-group {{theme}} {{size}}" data-ax5combobox-option-group="{{id}}">\n <div class="ax-combobox-body">\n <div class="ax-combobox-option-group-content" data-els="content"></div>\n </div>\n <div class="ax-combobox-arrow"></div> \n</div>\n'}),o=function(e){return'\n<div class="form-control {{formSize}} ax5combobox-display {{theme}}" \ndata-ax5combobox-display="{{id}}" data-ax5combobox-instance="{{instanceId}}">\n <div class="ax5combobox-display-table" data-els="display-table">\n <div data-ax5combobox-display="label-holder"> \n <a {{^tabIndex}}href="#ax5combobox-{{id}}" {{/tabIndex}}{{#tabIndex}}tabindex="{{tabIndex}}" {{/tabIndex}}\n data-ax5combobox-display="label"\n contentEditable="true"\n spellcheck="false">{{{label}}}</a>\n </div>\n <div data-ax5combobox-display="addon"> \n {{#multiple}}{{#reset}}\n <span class="addon-icon-reset" data-selected-clear="true">{{{.}}}</span>\n {{/reset}}{{/multiple}}\n {{#icons}}\n <span class="addon-icon-closed">{{clesed}}</span>\n <span class="addon-icon-opened">{{opened}}</span>\n {{/icons}}\n {{^icons}}\n <span class="addon-icon-closed"><span class="addon-icon-arrow"></span></span>\n <span class="addon-icon-opened"><span class="addon-icon-arrow"></span></span>\n {{/icons}}\n </div>\n </div>\n</a>\n'},i=function(e){return'\n<select tabindex="-1" class="form-control {{formSize}}" name="{{name}}" {{#multiple}}multiple="multiple"{{/multiple}}></select>\n'},n=function(e){return'\n{{#waitOptions}}\n <div class="ax-combobox-option-item">\n <div class="ax-combobox-option-item-holder">\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">\n {{{lang.loading}}}\n </span>\n </div>\n </div>\n{{/waitOptions}}\n{{^waitOptions}}\n {{#options}}\n {{#optgroup}}\n <div class="ax-combobox-option-group">\n <div class="ax-combobox-option-item-holder">\n <span class="ax-combobox-option-group-label">\n {{{.}}}\n </span>\n </div>\n {{#options}}\n {{^hide}}\n <div class="ax-combobox-option-item" data-option-focus-index="{{@findex}}" data-option-group-index="{{@gindex}}" data-option-index="{{@index}}" \n data-option-value="{{'+e.optionValue+'}}" \n {{#'+e.optionSelected+'}}data-option-selected="true"{{/'+e.optionSelected+'}}>\n <div class="ax-combobox-option-item-holder">\n {{#multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-checkbox">\n <span class="item-checkbox-wrap useCheckBox" data-option-checkbox-index="{{@i}}"></span>\n </span>\n {{/multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">{{'+e.optionText+'}}</span>\n </div>\n </div>\n {{/hide}}\n {{/options}}\n </div> \n {{/optgroup}}\n {{^optgroup}}\n {{^hide}}\n <div class="ax-combobox-option-item" data-option-focus-index="{{@findex}}" data-option-index="{{@index}}" data-option-value="{{'+e.optionValue+'}}" {{#'+e.optionSelected+'}}data-option-selected="true"{{/'+e.optionSelected+'}}>\n <div class="ax-combobox-option-item-holder">\n {{#multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-checkbox">\n <span class="item-checkbox-wrap useCheckBox" data-option-checkbox-index="{{@i}}"></span>\n </span>\n {{/multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">{{'+e.optionText+'}}</span>\n </div>\n </div>\n {{/hide}}\n {{/optgroup}}\n {{/options}}\n {{^options}}\n <div class="ax-combobox-option-item">\n <div class="ax-combobox-option-item-holder">\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">\n {{{lang.noOptions}}}\n </span>\n </div>\n </div>\n {{/options}}\n{{/waitOptions}}\n'},s=function(e){return'{{#selected}}<div tabindex="-1" data-ax5combobox-selected-label="{{@i}}" data-ax5combobox-selected-text="{{text}}">\n<div data-ax5combobox-remove="true" data-ax5combobox-remove-index="{{@i}}">{{{removeIcon}}}</div>\n<span>{{text}}</span>\n</div>{{/selected}}'};e.tmpl={comboboxDisplay:o,formSelect:i,optionGroup:t,options:n,label:s}}(),function(){var e=ax5.ui.combobox,t=(ax5.util,{1:function(e,t,o){var i=this.config,n=t;$(t).find("span").get(0)&&(n=$(t).find("span").get(0));var s,a,l=(n.textContent||n.innerText).replace(/^[\s\r\n\t]*|[\s\r\n\t]*$/g,""),c=this.queue[e];if(c.selected&&c.selected.length>0&&t.getAttribute("data-ax5combobox-selected-text")==l)return s=t.getAttribute("data-ax5combobox-selected-label"),a=c.selected[s],{index:{gindex:a["@gindex"],index:a["@index"],value:a[i.columnKeys.optionValue]}};if(t.getAttribute("data-ax5combobox-selected-text"))return l;if(""!=l){var a;return c.optionFocusIndex>-1&&(a=c.indexedOptions[c.optionFocusIndex])&&a[i.columnKeys.optionText].substr(0,l.length)===l?{index:{gindex:a["@gindex"],index:a["@index"],value:a[i.columnKeys.optionValue]}}:this.queue[e].editable||o?l:void 0}},3:function(e,t,o){var i=(this.config,(t.textContent||t.innerText).replace(/^[\s\r\n\t]*|[\s\r\n\t]*$/g,"")),n=this.queue[e];if(""!=i){var s;return n.optionFocusIndex>-1&&(s=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+n.optionFocusIndex+'"]')),n.optionFocusIndex>-1&&s.get(0)&&s.attr("data-option-value")?{index:{gindex:s.attr("data-option-group-index"),index:s.attr("data-option-index")}}:n.editable||o?i:void 0}}});e.util={nodeTypeProcessor:t}}(); | ||
"use strict";!function(){var e,t=ax5.ui,o=ax5.util;t.addClass({className:"combobox",version:"0.3.2"},function(){var t=function(){var t,i=this;this.instanceId=ax5.getGuid(),this.config={theme:"default",animateTime:250,removeIcon:"X",lang:{noSelected:"",noOptions:"no options",loading:"now loading.."},columnKeys:{optionValue:"value",optionText:"text",optionSelected:"selected"}},this.queue=[],this.activecomboboxOptionGroup=null,this.activecomboboxQueueIndex=-1,this.openTimer=null,this.closeTimer=null,this.waitOptionsCallback=null,this.keyUpTimer=null,t=this.config;var n=function(e,t){return e&&e.onStateChanged?e.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),"changeValue"==t.state&&(e&&e.onChange?e.onChange.call(t,t):this.onChange&&this.onChange.call(t,t)),e=null,t=null,!0},s=function(){for(var e,t=this.queue.length;t--;){var i=this.queue[t];if(i.$display&&(e=Math.max(i.$select.outerWidth(),o.number(i.minWidth)),i.$display.css({"min-width":e}),i.reset&&i.$display.find(".addon-icon-reset").css({"line-height":this.queue[t].$display.height()+"px"}),i.multiple)){var n=function(){return o.number(i.$display.css("border-top-width"))+o.number(i.$display.css("border-bottom-width"))}.call(this);i.$target.height(""),i.$display.height("");var s=i.$displayTable.outerHeight();Math.abs(s-i.$target.height())>n&&(i.$target.css({height:s+n}),i.$display.css({height:s+n}))}}return t=null,e=null,this},a=function(e){if(!this.activecomboboxOptionGroup)return this;var t=this.queue[this.activecomboboxQueueIndex],o={},i={};e&&jQuery(document.body).append(this.activecomboboxOptionGroup),o=t.$target.offset(),i={width:t.$target.outerWidth(),height:t.$target.outerHeight()},t.direction&&""!==t.direction&&"auto"!==t.direction||(t.direction="top"),e&&this.activecomboboxOptionGroup.addClass("direction-"+t.direction),this.activecomboboxOptionGroup.css(function(){return"top"==t.direction?{left:o.left,top:o.top+i.height+1,width:i.width}:"bottom"==t.direction?{left:o.left,top:o.top-this.activecomboboxOptionGroup.outerHeight()-1,width:i.width}:void 0}.call(this))},l=function(e,t){if(!this.activecomboboxOptionGroup)return this;var i=this.queue[this.activecomboboxQueueIndex],n="display";return(t=o.findParentNode(e.target,function(e){return e.getAttribute("data-option-value")?(n="optionItem",!0):i.$target.get(0)==e?(n="display",!0):void 0}))?("optionItem"===n&&($.call(this,i.id,{index:{gindex:t.getAttribute("data-option-group-index"),index:t.getAttribute("data-option-index")}},void 0,"internal"),o.selectRange(i.$displayLabel,"end"),i.multiple||this.close()),this):(this.close(),this)},c=function(t){if(t.keyCode==ax5.info.eventKeys.ESC)this.close();else if(t.which==ax5.info.eventKeys.RETURN){for(var o=[],i=this.queue[this.activecomboboxQueueIndex],n=i.$displayLabel.get(0).childNodes,s=0,a=n.length;a>s;s++){var l=n[s];if(l.nodeType in e.util.nodeTypeProcessor){var c=e.util.nodeTypeProcessor[l.nodeType].call(this,this.activecomboboxQueueIndex,l);"undefined"!=typeof c&&o.push(c)}}$.call(this,i.id,o,!0),r.call(this,this.activecomboboxQueueIndex),i.multiple||this.close()}},u=function(t){var o=this.queue[t],i={};return i.id=o.id,i.theme=o.theme,i.size="ax5combobox-option-group-"+o.size,i.multiple=o.multiple,i.lang=o.lang,i.options=o.options,i.selected=o.selected,i.hasSelected=i.selected&&i.selected.length>0,i.removeIcon=o.removeIcon,ax5.mustache.render(e.tmpl.label.call(this,o.columnKeys),i)+" "},d=function(e){var t,i=this.queue[e];if(i.$displayLabel.html(u.call(this,e)),i.$target.height(""),i.$display.height(""),i.$target.height()<(t=i.$displayTable.outerHeight())){var n=function(){return o.number(i.$display.css("border-top-width"))+o.number(i.$display.css("border-bottom-width"))}();i.$target.css({height:t+n}),i.$display.css({height:t+n})}},r=function(e){this.queue[e].$displayLabel.trigger("focus"),o.selectRange(this.queue[e].$displayLabel,"end")},p=function(e){this.queue[e].$displayLabel.trigger("blur")},h=function(e,t){this.queue[e].waitOptions=!0,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(getOptionsTmpl.call(this,this.queue[e].columnKeys),this.queue[e]))),this.queue[e].onSearch.call({self:this,item:this.queue[e],searchWord:t},function(e){var t={},i=this.queue[this.activecomboboxQueueIndex];return i?(function(e,t){var i={};t.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),o.isArray(e.selected)&&e.selected.forEach(function(o){i[o[e.columnKeys.optionValue]]&&(t.options[i[o[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(i,e),i.options=f.call(this,this.activecomboboxQueueIndex,e.options),s.call(this),t.id=i.id,t.theme=i.theme,t.size="ax5combobox-option-group-"+i.size,t.multiple=i.multiple,t.lang=i.lang,t.options=i.options,void this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(getOptionsTmpl.call(this,i.columnKeys),t)))):!1}.bind(this))},x=function(e,t){if(-1==this.activecomboboxQueueIndex)return this;var o,i=[],n=-1,s=this.queue[e].indexedOptions.length-1;if(""!=t){var a=/[\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]/gi;if(t=t.replace(a,""),this.queue[e].onSearch){h.call(this,e,t);try{return i}finally{i=null,n=null,s=null,o=null}}for(;s-n++;){if(o=this.queue[e].indexedOptions[n],(""+o.text).toLowerCase()==t.toLowerCase()){i=[{"@findex":o["@findex"],optionsSort:0}];break}var l=(""+o.text).toLowerCase().search(t.toLowerCase());if(l>-1&&(i.push({"@findex":o["@findex"],optionsSort:l}),i.length>2))break;l=null}i.sort(function(e,t){return e.optionsSort-t.optionsSort})}i&&i.length>0?m.call(this,e,void 0,i[0]["@findex"]):b.call(this,e);try{return i}finally{i=null,n=null,s=null,o=null}},b=function(e){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover").removeAttr("data-option-selected"),this.queue[e].optionFocusIndex=-1},m=function(e,t,i){var n,s,a,l,c=this.queue[e];if(this.activecomboboxOptionGroup&&c.options&&c.options.length>0){if("undefined"!=typeof i?n=i:(s=-1==c.optionFocusIndex?c.optionSelectedIndex||-1:c.optionFocusIndex,-1==s?n=0:(n=s+t,0>n?n=0:n>c.optionItemLength-1&&(n=c.optionItemLength-1))),c.optionFocusIndex=n,c.options[n]&&c.options[n].hide){if("undefined"==typeof t)return this;for(;c.options[n].hide;){if(n+=t,0>n){n=0;break}if(n>c.optionItemLength-1){n=c.optionItemLength-1;break}}}if("undefined"!=typeof n&&(this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover"),a=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+n+'"]').addClass("hover"),l=this.activecomboboxOptionGroup.find('[data-els="content"]'),a.get(0))){var u=a.outerHeight(),d=l.innerHeight(),r=l.scrollTop(),p=a.position().top+l.scrollTop();if(p+u>d+r?l.scrollTop(p+u-d):r>p&&l.scrollTop(p),"undefined"!=typeof t){var h=c.$displayLabel.get(0).childNodes,x=h[h.length-1];x&&"3"==x.nodeType?(x.nodeValue=c.indexedOptions[n].text,o.selectRange(c.$displayLabel,"end")):x&&"1"==x.nodeType&&(jQuery(x).after(c.indexedOptions[n].text),o.selectRange(c.$displayLabel,"end"))}}}},f=function(){var e=function(e,t){t?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected=[]};return function(t,n){var s,a,l,c=this.queue[t],u=0;return e.call(this,t,!1),n?(c.options=n,c.indexedOptions=[],s=[],s.push('<option value=""></option>'),c.options.forEach(function(o,n){o.optgroup?(o["@gindex"]=n,o.options.forEach(function(o,a){o["@index"]=a,o["@findex"]=u,s.push('<option value="'+o[c.columnKeys.optionValue]+'" '+(o[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+o[c.columnKeys.optionText]+"</option>"),o[c.columnKeys.optionSelected]&&e.call(i,t,o),c.indexedOptions.push({"@gindex":n,"@index":a,"@findex":u,value:o[c.columnKeys.optionValue],text:o[c.columnKeys.optionText]}),u++})):(o["@index"]=n,o["@findex"]=u,s.push('<option value="'+o[c.columnKeys.optionValue]+'" '+(o[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+o[c.columnKeys.optionText]+"</option>"),o[c.columnKeys.optionSelected]&&e.call(i,t,o),c.indexedOptions.push({"@index":n,"@findex":u,value:o[c.columnKeys.optionValue],text:o[c.columnKeys.optionText]}),u++)}),c.optionItemLength=u,c.$select.html(s.join(""))):(c.$select.get(0).options&&c.$select.get(0).options.length&&(c.$select.get(0).options[0].selected=!1),a=o.toArray(c.$select.get(0).options),l=[],a.forEach(function(o,n){var s={};s[c.columnKeys.optionValue]=o.value,s[c.columnKeys.optionText]=o.text,s[c.columnKeys.optionSelected]=o.selected,s["@index"]=n,s["@findex"]=u,o.selected&&e.call(i,t,s),l.push(s),u++,s=null}),c.options=l,c.indexedOptions=l,c.$select.prepend('<option value=""></option>'),c.$select.get(0).options[0].selected=!0),s=null,a=null,l=null,c.options}}(),v=function(e){return e instanceof jQuery?e=e.data("data-ax5combobox-id"):o.isString(e)||(e=jQuery(e).data("data-ax5combobox-id")),o.isString(e)?o.search(this.queue,function(){return this.id==e}):void console.log(ax5.info.getError("ax5combobox","402","getQueIdx"))},g=function(e,t,o){return"undefined"==typeof o?e.multiple?!t:!0:o},y=function(e){this.queue[e].options.forEach(function(e){e.optgroup?e.options.forEach(function(e){e.selected=!1}):e.selected=!1})},$=function(){var e={index:function(e,t,n,s){var l=this.queue[e];o.isString(t.index.gindex)?"undefined"!=typeof l.options[t.index.gindex]&&(l.options[t.index.gindex].options[t.index.index][l.columnKeys.optionSelected]=g(l,l.options[t.index.gindex].options[t.index.index][l.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-group-index="'+t.index.gindex+'"][data-option-index="'+t.index.index+'"]').attr("data-option-Selected",l.options[t.index.gindex].options[t.index.index][l.columnKeys.optionSelected].toString())):"undefined"!=typeof l.options[t.index.index]&&(l.options[t.index.index][l.columnKeys.optionSelected]=g(l,l.options[t.index.index][l.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-index="'+t.index.index+'"]').attr("data-option-Selected",l.options[t.index.index][l.columnKeys.optionSelected].toString())),("undefined"==typeof s||"justSetValue"!==s)&&(f.call(this,e,l.options),d.call(this,e),a.call(this))},arr:function(t,n,s,l){n.forEach(function(n){if(o.isString(n)||o.isNumber(n))e.text.call(i,t,n,s,"justSetValue");else for(var a in e)if(n[a]){e[a].call(i,t,n,s,"justSetValue");break}}),f.call(this,t,this.queue[t].options),d.call(this,t),a.call(this)},value:function(e,t,i,n){var s,l=this.queue[e],c=o.search(l.options,function(){return this[l.columnKeys.optionValue]==t[l.columnKeys.optionValue]});c>-1?l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i):(c=l.options.length,s={"@index":c,hide:!0,addedOption:!0},s[l.columnKeys.optionValue]=t,s[l.columnKeys.optionText]=t,l.options.push(s),l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i)),("undefined"==typeof n||"justSetValue"!==n)&&(f.call(this,e,this.queue[e].options),d.call(this,e),a.call(this))},text:function(e,t,i,n){var s,l=this.queue[e],c=o.search(l.options,function(){return this[l.columnKeys.optionText]==t});c>-1?l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i):(c=l.options.length,s={"@index":c,hide:!0,addedOption:!0},s[l.columnKeys.optionValue]=t,s[l.columnKeys.optionText]=t,l.options.push(s),l.options[c][l.columnKeys.optionSelected]=g(l,l.options[c][l.columnKeys.optionSelected],i)),("undefined"==typeof n||"justSetValue"!==n)&&(f.call(this,e,this.queue[e].options),d.call(this,e),a.call(this))},clear:function(e){y.call(this,e),f.call(this,e,this.queue[e].options),r.call(this,e),b.call(this,e),this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-index]").attr("data-option-Selected","false"),this.queue[e].optionSelectedIndex=-1}};return function(t,i,s,a){var l=o.isNumber(t)?t:v.call(this,t);if(-1===l)return void console.log(ax5.info.getError("ax5combobox","402","val"));if("undefined"==typeof i)throw"error not found value";if(o.isArray(i))e.clear.call(this,l),e.arr.call(this,l,this.queue[l].multiple||0==i.length?i:[i[i.length-1]],s);else if(o.isString(i)||o.isNumber(i))"undefined"==typeof i||null===i||this.queue[l].multiple||y.call(this,l),e.text.call(this,l,i,s),d.call(this,l);else if(null===i)e.clear.call(this,l),d.call(this,l);else{this.queue[l].multiple||y.call(this,l);for(var c in e)if(i[c]){e[c].call(this,l,i,s);break}d.call(this,l)}return"undefined"!=typeof i&&a&&!a.noStateChange&&n.call(this,this.queue[l],{self:this,item:this.queue[l],state:"changeValue",value:this.queue[l].selected}),t=null,this}}();this.init=function(){this.onStateChanged=t.onStateChanged,this.onChange=t.onChange,jQuery(window).bind("resize.ax5combobox-display-"+this.instanceId,function(){s.call(this)}.bind(this))},this.bind=function(n){var a,l=function(){var t=o.debounce(function(t){if(-1==this.activecomboboxQueueIndex)return this;for(var n=[],s="",a=this.queue[t],l=a.$displayLabel.get(0).childNodes,c=0,u=l.length;u>c;c++){var d=l[c];if(d.nodeType in e.util.nodeTypeProcessor){var r=e.util.nodeTypeProcessor[d.nodeType].call(this,this.activecomboboxQueueIndex,d,!0);"undefined"==typeof r||(o.isString(r)?(s=r,"1"==d.nodeType&&d.getAttribute("data-ax5combobox-selected-text")?s=!1:n.push(r)):n.push(r))}}0==l.length?$.call(this,a.id,null,void 0,"internal"):s===!1?($.call(this,a.id,null,void 0,"internal"),$.call(this,a.id,n,void 0,"internal"),o.selectRange(a.$displayLabel,"end")):""!=s&&x.call(i,t,s)},150),n=function(t){for(var i,n=[],s=this.queue[t],a=s.$displayLabel.get(0).childNodes,l=0,c=a.length;c>l;l++){var u=a[l];if(u.nodeType in e.util.nodeTypeProcessor){var d=e.util.nodeTypeProcessor[u.nodeType].call(this,t,u,!0);"undefined"==typeof d||(o.isString(d)?(i=d,n.push(d)):n.push(d))}}"undefined"!=typeof i&&$.call(this,s.id,n,void 0,"internal")},a={click:function(e,t){var n,s=o.findParentNode(t.target,function(e){return e.getAttribute("data-ax5combobox-remove")?(n="optionItemRemove",!0):e.getAttribute("data-selected-clear")?(n="clear",!0):void 0});if(s){if("optionItemRemove"===n){var a=s.getAttribute("data-ax5combobox-remove-index"),l=this.queue[e].selected[a];return $.call(this,e,{index:{gindex:l["@gindex"],index:l["@index"]}},!1,!0),r.call(this,e),o.stopEvent(t),this}"clear"===n&&$.call(this,e,{clear:!0})}else i.activecomboboxQueueIndex==e?-1==this.queue[e].optionFocusIndex&&i.close():(i.open(e),""==this.queue[e].$displayLabel.text().replace(/^\W*|\W*$/g,"")&&(this.queue[e].$displayLabel.html(u.call(this,e)),r.call(this,e)))},keyUp:function(e,n){return n.which==ax5.info.eventKeys.ESC&&-1===i.activecomboboxQueueIndex?(o.stopEvent(n),this):(i.activecomboboxQueueIndex!=e&&(i.open(e),o.stopEvent(n)),void t.call(this,e))},keyDown:function(e,t){t.which==ax5.info.eventKeys.ESC?o.stopEvent(t):t.which==ax5.info.eventKeys.RETURN?o.stopEvent(t):t.which==ax5.info.eventKeys.DOWN?(m.call(this,e,1),o.stopEvent(t)):t.which==ax5.info.eventKeys.UP&&(m.call(this,e,-1),o.stopEvent(t))},focus:function(e,t){},blur:function(e,t){n.call(this,e),o.stopEvent(t)},selectChange:function(e,t){$.call(this,e,{value:this.queue[e].$select.val()},!0)}};return function(t){var o=this.queue[t],i={};return o.selected=[],o.$display?(o.$displayLabel.html(u.call(this,t)),o.options=f.call(this,t,o.options),s.call(this)):(i.instanceId=this.instanceId,i.id=o.id,i.name=o.name,i.theme=o.theme,i.tabIndex=o.tabIndex,i.multiple=o.multiple,i.reset=o.reset,i.label=u.call(this,t),i.formSize=function(){return o.size?"input-"+o.size:""}(),o.$display=jQuery(ax5.mustache.render(e.tmpl.comboboxDisplay.call(this,t),i)),o.$displayTable=o.$display.find('[data-els="display-table"]'),o.$displayLabel=o.$display.find('[data-ax5combobox-display="label"]'),o.$target.find("select").get(0)?(o.$select=o.$target.find("select"),o.$select.attr("tabindex","-1").attr("class","form-control "+i.formSize),i.name&&o.$select.attr("name","name"),i.multiple&&o.$select.attr("multiple","multiple")):(o.$select=jQuery(ax5.mustache.render(e.tmpl.formSelect.call(this,t),i)),o.$target.append(o.$select)),o.$target.append(o.$display),o.options=f.call(this,t,o.options),s.call(this)),o.$display.unbind("click.ax5combobox").bind("click.ax5combobox",a.click.bind(this,t)),o.$displayLabel.unbind("focus.ax5combobox").bind("focus.ax5combobox",a.focus.bind(this,t)).unbind("blur.ax5combobox").bind("blur.ax5combobox",a.blur.bind(this,t)).unbind("keyup.ax5combobox").bind("keyup.ax5combobox",a.keyUp.bind(this,t)).unbind("keydown.ax5combobox").bind("keydown.ax5combobox",a.keyDown.bind(this,t)),o.$select.unbind("change.ax5combobox").bind("change.ax5combobox",a.selectChange.bind(this,t)),i=null,o=null,t=null,this}}(),c={};return n=jQuery.extend(!0,c,t,n),n.target?(n.$target=jQuery(n.target),n.id||(n.id=n.$target.data("data-ax5combobox-id")),n.id||(n.id="ax5combobox-"+ax5.getGuid(),n.$target.data("data-ax5combobox-id",n.id)),n.name=n.$target.attr("data-ax5combobox"),n.options&&(n.options=JSON.parse(JSON.stringify(n.options))),function(e){o.isObject(e)&&!e.error&&(n=jQuery.extend(!0,n,e))}(o.parseJson(n.$target.attr("data-ax5combobox-config"),!0)),a=o.search(this.queue,function(){return this.id==n.id}),-1===a?(this.queue.push(n),l.call(this,this.queue.length-1)):(this.queue[a]=jQuery.extend(!0,{},this.queue[a],n),l.call(this,a)),c=null,a=null,this):(console.log(ax5.info.getError("ax5combobox","401","bind")),this)},this.open=function(){var i=function(t){t.onExpand.call({self:this,item:t},function(t){if(this.waitOptionsCallback){var i={},n=this.queue[this.activecomboboxQueueIndex];!function(e,t){var i={};t.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),o.isArray(e.selected)&&e.selected.forEach(function(o){i[o[e.columnKeys.optionValue]]&&(t.options[i[o[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(n,t),n.$display.find('[data-ax5combobox-display="label"]').html(u.call(this,this.activecomboboxQueueIndex)),n.options=f.call(this,this.activecomboboxQueueIndex,t.options),s.call(this),i.id=n.id,i.theme=n.theme,i.size="ax5combobox-option-group-"+n.size,i.multiple=n.multiple,i.lang=n.lang,i.options=n.options,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(e.tmpl.options.call(this,n.columnKeys),i)))}}.bind(this))};return function(s,u){this.waitOptionsCallback=null;var d,r,p=o.isNumber(s)?s:v.call(this,s),h=this.queue[p],x={};return h.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activecomboboxOptionGroup?this.activecomboboxQueueIndex==p?this:u>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(p,(u||0)+1)}.bind(this),t.animateTime),this):(h.optionFocusIndex=-1,h.selected&&h.selected.length>0&&(h.optionSelectedIndex=h.selected[0]["@findex"]),x.id=h.id,x.theme=h.theme,x.size="ax5combobox-option-group-"+h.size,x.multiple=h.multiple,x.lang=h.lang,h.$display.attr("data-combobox-option-group-opened","true"),h.onExpand&&(x.waitOptions=!0),x.options=o.filter(h.options,function(){return!this.hide}),this.activecomboboxOptionGroup=jQuery(ax5.mustache.render(e.tmpl.optionGroup.call(this,h.columnKeys),x)),this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(e.tmpl.options.call(this,h.columnKeys),x))),this.activecomboboxQueueIndex=p,a.call(this,"append"),jQuery(window).bind("resize.ax5combobox-"+this.instanceId,function(){a.call(this)}.bind(this)),h.selected&&h.selected.length>0&&(r=this.activecomboboxOptionGroup.find('[data-option-index="'+h.selected[0]["@index"]+'"]'),r.get(0)&&(d=r.position().top-this.activecomboboxOptionGroup.height()/3,this.activecomboboxOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:d},h.animateTime,"swing",function(){}))),jQuery(window).bind("keyup.ax5combobox-"+this.instanceId,function(e){e=e||window.event,c.call(this,e),o.stopEvent(e)}.bind(this)),jQuery(window).bind("click.ax5combobox-"+this.instanceId,function(e){e=e||window.event,l.call(this,e),o.stopEvent(e)}.bind(this)),n.call(this,h,{self:this,state:"open",item:h}),h.onExpand&&(this.waitOptionsCallback=!0,i.call(this,h)),x=null,d=null,r=null,this))}}(),this.update=function(e){return this.bind(e),this},this.setValue=function(e,t,i){var n=o.isNumber(e)?e:v.call(this,e);if(-1===n)return void console.log(ax5.info.getError("ax5combobox","402","val"));if(y.call(this,n),o.isArray(t)){var s=o.map(t,function(){return{value:this}});$.call(this,n,s,i||!0,{noStateChange:!0})}else(o.isString(t)||o.isNumber(t))&&$.call(this,n,{value:t},i||!0,{noStateChange:!0});return p.call(this,n),this},this.setText=function(e,t,i){var n=o.isNumber(e)?e:v.call(this,e);return-1===n?void console.log(ax5.info.getError("ax5combobox","402","val")):(y.call(this,n),$.call(this,n,t,!0,{noStateChange:!0}),p.call(this,n),this)},this.getSelectedOption=function(e){var t=o.isNumber(e)?e:v.call(this,e);return-1===t?void console.log(ax5.info.getError("ax5combobox","402","val")):o.deepCopy(this.queue[t].selected)},this.close=function(e){return this.closeTimer&&clearTimeout(this.closeTimer),this.activecomboboxOptionGroup?(e=this.queue[this.activecomboboxQueueIndex],e.optionFocusIndex=-1,e.$display.removeAttr("data-combobox-option-group-opened").trigger("focus"),this.activecomboboxOptionGroup.addClass("destroy"),jQuery(window).unbind("resize.ax5combobox-"+this.instanceId).unbind("click.ax5combobox-"+this.instanceId).unbind("keyup.ax5combobox-"+this.instanceId),this.closeTimer=setTimeout(function(){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.remove(),this.activecomboboxOptionGroup=null,this.activecomboboxQueueIndex=-1,n.call(this,e,{self:this,state:"close"})}.bind(this),t.animateTime),this.waitOptionsCallback=null,this):this},this.blur=function(e){var t=o.isNumber(e)?e:v.call(this,e);return-1===t?void console.log(ax5.info.getError("ax5combobox","402","val")):(p.call(this,t),this)},this.enable=function(e){var t=v.call(this,e);return this.queue[t].$display.removeAttr("disabled"),this.queue[t].$input.removeAttr("disabled"),n.call(this,this.queue[t],{self:this,state:"enable"}),this},this.disable=function(e){var t=v.call(this,e);return this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$input.attr("disabled","disabled"),n.call(this,this.queue[t],{self:this,state:"disable"}),this},this.main=function(){arguments&&o.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)};return t}()),e=ax5.ui.combobox}(),ax5.ui.combobox_instance=new ax5.ui.combobox,jQuery.fn.ax5combobox=function(){return function(e){if(ax5.util.isString(arguments[0])){var t=arguments[0];switch(t){case"open":return ax5.ui.combobox_instance.open(this);case"close":return ax5.ui.combobox_instance.close(this);case"setValue":return ax5.ui.combobox_instance.setValue(this,arguments[1],arguments[2],arguments[3],arguments[4]||"justSetValue");case"setText":return ax5.ui.combobox_instance.setText(this,arguments[1],arguments[2],arguments[3],arguments[4]||"justSetValue");case"getSelectedOption":return ax5.ui.combobox_instance.getSelectedOption(this);case"enable":return ax5.ui.combobox_instance.enable(this);case"disable":return ax5.ui.combobox_instance.disable(this);case"blur":return ax5.ui.combobox_instance.blur(this);default:return this}}else"undefined"==typeof e&&(e={}),jQuery.each(this,function(){var t={target:this};e=jQuery.extend({},e,t),ax5.ui.combobox_instance.bind(e)});return this}}(),function(){var e=ax5.ui.combobox,t=(ax5.util,function(e){return'\n<div class="ax5combobox-option-group {{theme}} {{size}}" data-ax5combobox-option-group="{{id}}">\n <div class="ax-combobox-body">\n <div class="ax-combobox-option-group-content" data-els="content"></div>\n </div>\n <div class="ax-combobox-arrow"></div> \n</div>\n'}),o=function(e){return'\n<div class="form-control {{formSize}} ax5combobox-display {{theme}}" \ndata-ax5combobox-display="{{id}}" data-ax5combobox-instance="{{instanceId}}">\n <div class="ax5combobox-display-table" data-els="display-table">\n <div data-ax5combobox-display="label-holder"> \n <a {{^tabIndex}}href="#ax5combobox-{{id}}" {{/tabIndex}}{{#tabIndex}}tabindex="{{tabIndex}}" {{/tabIndex}}\n data-ax5combobox-display="label"\n contentEditable="true"\n spellcheck="false">{{{label}}}</a>\n </div>\n <div data-ax5combobox-display="addon"> \n {{#multiple}}{{#reset}}\n <span class="addon-icon-reset" data-selected-clear="true">{{{.}}}</span>\n {{/reset}}{{/multiple}}\n {{#icons}}\n <span class="addon-icon-closed">{{clesed}}</span>\n <span class="addon-icon-opened">{{opened}}</span>\n {{/icons}}\n {{^icons}}\n <span class="addon-icon-closed"><span class="addon-icon-arrow"></span></span>\n <span class="addon-icon-opened"><span class="addon-icon-arrow"></span></span>\n {{/icons}}\n </div>\n </div>\n</a>\n'},i=function(e){return'\n<select tabindex="-1" class="form-control {{formSize}}" name="{{name}}" {{#multiple}}multiple="multiple"{{/multiple}}></select>\n'},n=function(e){return'\n{{#waitOptions}}\n <div class="ax-combobox-option-item">\n <div class="ax-combobox-option-item-holder">\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">\n {{{lang.loading}}}\n </span>\n </div>\n </div>\n{{/waitOptions}}\n{{^waitOptions}}\n {{#options}}\n {{#optgroup}}\n <div class="ax-combobox-option-group">\n <div class="ax-combobox-option-item-holder">\n <span class="ax-combobox-option-group-label">\n {{{.}}}\n </span>\n </div>\n {{#options}}\n {{^hide}}\n <div class="ax-combobox-option-item" data-option-focus-index="{{@findex}}" data-option-group-index="{{@gindex}}" data-option-index="{{@index}}" \n data-option-value="{{'+e.optionValue+'}}" \n {{#'+e.optionSelected+'}}data-option-selected="true"{{/'+e.optionSelected+'}}>\n <div class="ax-combobox-option-item-holder">\n {{#multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-checkbox">\n <span class="item-checkbox-wrap useCheckBox" data-option-checkbox-index="{{@i}}"></span>\n </span>\n {{/multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">{{'+e.optionText+'}}</span>\n </div>\n </div>\n {{/hide}}\n {{/options}}\n </div> \n {{/optgroup}}\n {{^optgroup}}\n {{^hide}}\n <div class="ax-combobox-option-item" data-option-focus-index="{{@findex}}" data-option-index="{{@index}}" data-option-value="{{'+e.optionValue+'}}" {{#'+e.optionSelected+'}}data-option-selected="true"{{/'+e.optionSelected+'}}>\n <div class="ax-combobox-option-item-holder">\n {{#multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-checkbox">\n <span class="item-checkbox-wrap useCheckBox" data-option-checkbox-index="{{@i}}"></span>\n </span>\n {{/multiple}}\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">{{'+e.optionText+'}}</span>\n </div>\n </div>\n {{/hide}}\n {{/optgroup}}\n {{/options}}\n {{^options}}\n <div class="ax-combobox-option-item">\n <div class="ax-combobox-option-item-holder">\n <span class="ax-combobox-option-item-cell ax-combobox-option-item-label">\n {{{lang.noOptions}}}\n </span>\n </div>\n </div>\n {{/options}}\n{{/waitOptions}}\n'},s=function(e){return'{{#selected}}<div tabindex="-1" data-ax5combobox-selected-label="{{@i}}" data-ax5combobox-selected-text="{{text}}">\n<div data-ax5combobox-remove="true" data-ax5combobox-remove-index="{{@i}}">{{{removeIcon}}}</div>\n<span>{{text}}</span>\n</div>{{/selected}}'};e.tmpl={comboboxDisplay:o,formSelect:i,optionGroup:t,options:n,label:s}}(),function(){var e=ax5.ui.combobox,t=(ax5.util,{1:function(e,t,o){var i=this.config,n=t;$(t).find("span").get(0)&&(n=$(t).find("span").get(0));var s,a,l=(n.textContent||n.innerText).replace(/^[\s\r\n\t]*|[\s\r\n\t]*$/g,""),c=this.queue[e];if(c.selected&&c.selected.length>0&&t.getAttribute("data-ax5combobox-selected-text")==l)return s=t.getAttribute("data-ax5combobox-selected-label"),a=c.selected[s],{index:{gindex:a["@gindex"],index:a["@index"],value:a[i.columnKeys.optionValue]}};if(t.getAttribute("data-ax5combobox-selected-text"))return l;if(""!=l){var a;return c.optionFocusIndex>-1&&(a=c.indexedOptions[c.optionFocusIndex])&&a[i.columnKeys.optionText].substr(0,l.length)===l?{index:{gindex:a["@gindex"],index:a["@index"],value:a[i.columnKeys.optionValue]}}:this.queue[e].editable||o?l:void 0}},3:function(e,t,o){var i=(this.config,(t.textContent||t.innerText).replace(/^[\s\r\n\t]*|[\s\r\n\t]*$/g,"")),n=this.queue[e];if(""!=i){var s;return n.optionFocusIndex>-1&&(s=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+n.optionFocusIndex+'"]')),n.optionFocusIndex>-1&&s.get(0)&&s.attr("data-option-value")?{index:{gindex:s.attr("data-option-group-index"),index:s.attr("data-option-index")}}:n.editable||o?i:void 0}}});e.util={nodeTypeProcessor:t}}(); |
{ | ||
"name": "ax5ui-combobox", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "A combobox plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "license": "LGPLv3", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280198