Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ax5ui-combobox

Package Overview
Dependencies
Maintainers
1
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ax5ui-combobox - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

2

bower.json
{
"name": "ax5ui-combobox",
"version": "0.2.2",
"version": "0.2.3",
"description": "A combobox plugin that works with Bootstrap & jQuery",

@@ -5,0 +5,0 @@ "authors": [

@@ -1,1 +0,1 @@

"use strict";!function(){var e=ax5.ui,t=ax5.util;e.addClass({className:"combobox",version:"0.2.2"},function(){var e=function(){var e,o=this;this.instanceId=ax5.getGuid(),this.config={theme:"default",animateTime:250,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,e=this.config;var i=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},n=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 '},s=function(){return'\n <div class="form-control {{formSize}} ax5combobox-display {{theme}}" \n data-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 '},a=function(){return'\n <select tabindex="-1" class="form-control {{formSize}}" name="{{name}}" {{#multiple}}multiple="multiple"{{/multiple}}></select>\n '},l=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 '},c=function(e){return'{{#selected}}<span tabindex="-1" data-ax5combobox-selected-label="{{@i}}" data-ax5combobox-selected-text="{{text}}">{{text}}</span>{{/selected}}'},d=function(){for(var e,o=this.queue.length;o--;){var i=this.queue[o];if(i.$display&&(e=Math.max(i.$select.outerWidth(),t.number(i.minWidth)),i.$display.css({"min-width":e}),i.reset&&i.$display.find(".addon-icon-reset").css({"line-height":this.queue[o].$display.height()+"px"}),i.multiple)){var n=function(){return t.number(i.$display.css("border-top-width"))+t.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 o=null,e=null,this},u=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))},p=function(e,o){if(!this.activecomboboxOptionGroup)return this;var i=this.queue[this.activecomboboxQueueIndex],n="display";return(o=t.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&&(this.val(i.id,{index:{gindex:o.getAttribute("data-option-group-index"),index:o.getAttribute("data-option-index")}},void 0,"internal"),t.selectRange(i.$displayLabel,"end"),i.multiple||this.close()),this):(this.close(),this)},r=function(e){if(e.keyCode==ax5.info.eventKeys.ESC)this.close();else if(e.which==ax5.info.eventKeys.RETURN){for(var t=[],o=this.queue[this.activecomboboxQueueIndex],i=o.$displayLabel.get(0).childNodes,n=0,s=i.length;s>n;n++){var a=i[n];if(a.nodeType in O){var l=O[a.nodeType].call(this,this.activecomboboxQueueIndex,a);"undefined"!=typeof l&&t.push(l)}}this.val(o.id,t,!0,"internal"),o.multiple||this.close()}},h=function(e){var t=this.queue[e],o={};return o.id=t.id,o.theme=t.theme,o.size="ax5combobox-option-group-"+t.size,o.multiple=t.multiple,o.lang=t.lang,o.options=t.options,o.selected=t.selected,o.hasSelected=o.selected&&o.selected.length>0,ax5.mustache.render(c.call(this,t.columnKeys),o)+"&nbsp;"},x=function(e){var o,i=this.queue[e];if(i.$displayLabel.html(h.call(this,e)),i.$target.height(""),i.$display.height(""),i.$target.height()<(o=i.$displayTable.outerHeight())){var n=function(){return t.number(i.$display.css("border-top-width"))+t.number(i.$display.css("border-bottom-width"))}();i.$target.css({height:o+n}),i.$display.css({height:o+n})}},b=function(e){this.queue[e].$displayLabel.trigger("focus"),t.selectRange(this.queue[e].$displayLabel,"end")},m=function(e,o){this.queue[e].waitOptions=!0,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,this.queue[e].columnKeys),this.queue[e]))),this.queue[e].onSearch.call({self:this,item:this.queue[e]},function(e){var o={},i=this.queue[this.activecomboboxQueueIndex];!function(e,o){var i={};o.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),t.isArray(e.selected)&&e.selected.forEach(function(t){i[t[e.columnKeys.optionValue]]&&(o.options[i[t[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(i,e),i.options=$.call(this,this.activecomboboxQueueIndex,e.options),d.call(this),o.id=i.id,o.theme=i.theme,o.size="ax5combobox-option-group-"+i.size,o.multiple=i.multiple,o.lang=i.lang,o.options=i.options,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,i.columnKeys),o)))}.bind(this))},f=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){m.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?g.call(this,e,void 0,i[0]["@findex"]):v.call(this,e);try{return i}finally{i=null,n=null,s=null,o=null}},v=function(e){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover").removeAttr("data-option-selected"),this.queue[e].optionFocusIndex=-1},g=function(e,o,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+o,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 o)return this;for(;c.options[n].hide;){if(n+=o,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 d=a.outerHeight(),u=l.innerHeight(),p=l.scrollTop(),r=a.position().top+l.scrollTop();if(r+d>u+p?l.scrollTop(r+d-u):p>r&&l.scrollTop(r),"undefined"!=typeof o){var h=c.$displayLabel.get(0).childNodes,x=h[h.length-1];if("1"!=x.nodeType&&(x=h[h.length-2]),!x)return this;x.getAttribute("data-ax5combobox-selected-text")||(x.innerHTML="&nbsp;"+c.indexedOptions[n].text,t.selectRange(c.$displayLabel,"end"))}}}},y=function(){var e=t.debounce(function(e){if(-1==this.activecomboboxQueueIndex)return this;for(var i=[],n="",s=this.queue[e],a=s.$displayLabel.get(0).childNodes,l=0,c=a.length;c>l;l++){var d=a[l];if(d.nodeType in O){var u=O[d.nodeType].call(this,this.activecomboboxQueueIndex,d,!0);"undefined"==typeof u||(t.isString(u)?(n=u,"1"==d.nodeType&&d.getAttribute("data-ax5combobox-selected-text")?n=!1:i.push(u)):i.push(u))}}0==a.length?this.val(s.id,null,void 0,"internal"):n===!1?(this.val(s.id,i,void 0,"internal"),t.selectRange(s.$displayLabel,"end")):""!=n&&f.call(o,e,n)},150),i=function(e){for(var o,i=[],n=this.queue[e],s=n.$displayLabel.get(0).childNodes,a=0,l=s.length;l>a;a++){var c=s[a];if(c.nodeType in O){var d=O[c.nodeType].call(this,e,c,!0);"undefined"==typeof d||(t.isString(d)?(o=d,i.push(d)):i.push(d))}}"undefined"!=typeof o&&this.val(n.id,i,void 0,"internal")},n={click:function(e,i){var n=t.findParentNode(i.target,function(e){return e.getAttribute("data-selected-clear")?!0:void 0});n?this.val(e,{clear:!0}):o.activecomboboxQueueIndex==e?-1==this.queue[e].optionFocusIndex&&o.close():(o.open(e),""==this.queue[e].$displayLabel.text().replace(/^\W*|\W*$/g,"")&&(this.queue[e].$displayLabel.html(h.call(this,e)),b.call(this,e)))},keyUp:function(i,n){return n.which==ax5.info.eventKeys.ESC&&-1===o.activecomboboxQueueIndex?(t.stopEvent(n),this):(o.activecomboboxQueueIndex!=i&&(o.open(i),t.stopEvent(n)),void e.call(this,i))},keyDown:function(e,o){o.which==ax5.info.eventKeys.ESC?t.stopEvent(o):o.which==ax5.info.eventKeys.RETURN?t.stopEvent(o):o.which==ax5.info.eventKeys.DOWN?(g.call(this,e,1),t.stopEvent(o)):o.which==ax5.info.eventKeys.UP&&(g.call(this,e,-1),t.stopEvent(o))},focus:function(e,t){},blur:function(e,o){i.call(this,e),t.stopEvent(o)},selectChange:function(e,t){this.val(e,this.queue[e].$select.val(),!0)}};return function(e){var t=this.queue[e],o={};return t.selected=[],t.$display?(t.$displayLabel.html(h.call(this,e)),t.options=$.call(this,e,t.options),d.call(this)):(o.instanceId=this.instanceId,o.id=t.id,o.name=t.name,o.theme=t.theme,o.tabIndex=t.tabIndex,o.multiple=t.multiple,o.reset=t.reset,o.label=h.call(this,e),o.formSize=function(){return t.size?"input-"+t.size:""}(),t.$display=jQuery(ax5.mustache.render(s.call(this,e),o)),t.$displayTable=t.$display.find('[data-els="display-table"]'),t.$displayLabel=t.$display.find('[data-ax5combobox-display="label"]'),t.$target.find("select").get(0)?(t.$select=t.$target.find("select"),t.$select.attr("tabindex","-1").attr("class","form-control "+o.formSize),o.name&&t.$select.attr("name","name"),o.multiple&&t.$select.attr("multiple","multiple")):(t.$select=jQuery(ax5.mustache.render(a.call(this,e),o)),t.$target.append(t.$select)),t.$target.append(t.$display),t.options=$.call(this,e,t.options),d.call(this)),t.$display.unbind("click.ax5combobox").bind("click.ax5combobox",n.click.bind(this,e)),t.$displayLabel.unbind("focus.ax5combobox").bind("focus.ax5combobox",n.focus.bind(this,e)).unbind("blur.ax5combobox").bind("blur.ax5combobox",n.blur.bind(this,e)).unbind("keyup.ax5combobox").bind("keyup.ax5combobox",n.keyUp.bind(this,e)).unbind("keydown.ax5combobox").bind("keydown.ax5combobox",n.keyDown.bind(this,e)),t.$select.unbind("change.ax5combobox").bind("change.ax5combobox",n.selectChange.bind(this,e)),o=null,t=null,e=null,this}}(),$=function(){var e=function(e,t){t?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected=[]};return function(i,n){var s,a,l,c=this.queue[i],d=0;return e.call(this,i,!1),n?(c.options=n,c.indexedOptions=[],s=[],s.push('<option value=""></option>'),c.options.forEach(function(t,n){t.optgroup?(t["@gindex"]=n,t.options.forEach(function(t,a){t["@index"]=a,t["@findex"]=d,s.push('<option value="'+t[c.columnKeys.optionValue]+'" '+(t[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+t[c.columnKeys.optionText]+"</option>"),t[c.columnKeys.optionSelected]&&e.call(o,i,t),c.indexedOptions.push({"@gindex":n,"@index":a,"@findex":d,value:t[c.columnKeys.optionValue],text:t[c.columnKeys.optionText]}),d++})):(t["@index"]=n,t["@findex"]=d,s.push('<option value="'+t[c.columnKeys.optionValue]+'" '+(t[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+t[c.columnKeys.optionText]+"</option>"),t[c.columnKeys.optionSelected]&&e.call(o,i,t),c.indexedOptions.push({"@index":n,"@findex":d,value:t[c.columnKeys.optionValue],text:t[c.columnKeys.optionText]}),d++)}),c.optionItemLength=d,c.$select.html(s.join(""))):(c.$select.get(0).options[0].selected=!1,a=t.toArray(c.$select.get(0).options),l=[],a.forEach(function(t,n){var s={};s[c.columnKeys.optionValue]=t.value,s[c.columnKeys.optionText]=t.text,s[c.columnKeys.optionSelected]=t.selected,s["@index"]=n,s["@findex"]=d,t.selected&&e.call(o,i,s),l.push(s),d++,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}}(),q=function(e){return t.isString(e)||(e=jQuery(e).data("data-ax5combobox-id")),t.isString(e)?t.search(this.queue,function(){return this.id==e}):void console.log(ax5.info.getError("ax5combobox","402","getQueIdx"))},S=function(e,t,o){return"undefined"==typeof o?e.multiple?!t:!0:o},I=function(e){this.queue[e].options.forEach(function(e){e.optgroup?e.options.forEach(function(e){e.selected=!1}):e.selected=!1})},O={1:function(t,o,i){var n,s,a=(o.textContent||o.innerText).replace(/^[\s\r\n\t]*|[\s\r\n\t]*$/g,""),l=this.queue[t];if(l.selected&&l.selected.length>0&&o.getAttribute("data-ax5combobox-selected-text")==a)return n=o.getAttribute("data-ax5combobox-selected-label"),s=l.selected[n],{index:{gindex:s["@gindex"],index:s["@index"],value:s[e.columnKeys.optionValue]}};if(o.getAttribute("data-ax5combobox-selected-text"))return a;if(""!=a){var s;return l.optionFocusIndex>-1&&(s=l.indexedOptions[l.optionFocusIndex])&&s[e.columnKeys.optionText].substr(0,a.length)===a?{index:{gindex:s["@gindex"],index:s["@index"],value:s[e.columnKeys.optionValue]}}:this.queue[t].editable||i?a:void 0}},3:function(e,t,o){var i=(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}}};this.init=function(){this.onStateChanged=e.onStateChanged,this.onChange=e.onChange,jQuery(window).bind("resize.ax5combobox-display-"+this.instanceId,function(){d.call(this)}.bind(this))},this.bind=function(o){var i,n={};return o=jQuery.extend(!0,n,e,o),o.target?(o.$target=jQuery(o.target),o.id||(o.id=o.$target.data("data-ax5combobox-id")),o.id||(o.id="ax5combobox-"+ax5.getGuid(),o.$target.data("data-ax5combobox-id",o.id)),o.name=o.$target.attr("data-ax5combobox"),o.options&&(o.options=JSON.parse(JSON.stringify(o.options))),function(e){t.isObject(e)&&!e.error&&(o=jQuery.extend(!0,o,e))}(t.parseJson(o.$target.attr("data-ax5combobox-config"),!0)),i=t.search(this.queue,function(){return this.id==o.id}),-1===i?(this.queue.push(o),y.call(this,this.queue.length-1)):(this.queue[i]=jQuery.extend(!0,{},this.queue[i],o),y.call(this,i)),n=null,i=null,this):(console.log(ax5.info.getError("ax5combobox","401","bind")),this)},this.open=function(){var o=function(e){e.onExpand.call({self:this,item:e},function(e){if(this.waitOptionsCallback){var o={},i=this.queue[this.activecomboboxQueueIndex];!function(e,o){var i={};o.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),t.isArray(e.selected)&&e.selected.forEach(function(t){i[t[e.columnKeys.optionValue]]&&(o.options[i[t[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(i,e),i.$display.find('[data-ax5combobox-display="label"]').html(h.call(this,this.activecomboboxQueueIndex)),i.options=$.call(this,this.activecomboboxQueueIndex,e.options),d.call(this),o.id=i.id,o.theme=i.theme,o.size="ax5combobox-option-group-"+i.size,o.multiple=i.multiple,o.lang=i.lang,o.options=i.options,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,i.columnKeys),o)))}}.bind(this))};return function(s,a){this.waitOptionsCallback=null;var c,d,h=t.isNumber(s)?s:q.call(this,s),x=this.queue[h],b={};return x.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activecomboboxOptionGroup?this.activecomboboxQueueIndex==h?this:a>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(h,(a||0)+1)}.bind(this),e.animateTime),this):(x.optionFocusIndex=-1,x.selected&&x.selected.length>0&&(x.optionSelectedIndex=x.selected[0]["@findex"]),b.id=x.id,b.theme=x.theme,b.size="ax5combobox-option-group-"+x.size,b.multiple=x.multiple,b.lang=x.lang,x.$display.attr("data-combobox-option-group-opened","true"),x.onExpand&&(b.waitOptions=!0),b.options=t.filter(x.options,function(){return!this.hide}),this.activecomboboxOptionGroup=jQuery(ax5.mustache.render(n.call(this,x.columnKeys),b)),this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,x.columnKeys),b))),this.activecomboboxQueueIndex=h,u.call(this,"append"),jQuery(window).bind("resize.ax5combobox-"+this.instanceId,function(){u.call(this)}.bind(this)),x.selected&&x.selected.length>0&&(d=this.activecomboboxOptionGroup.find('[data-option-index="'+x.selected[0]["@index"]+'"]'),d.get(0)&&(c=d.position().top-this.activecomboboxOptionGroup.height()/3,this.activecomboboxOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:c},x.animateTime,"swing",function(){}))),jQuery(window).bind("keyup.ax5combobox-"+this.instanceId,function(e){e=e||window.event,r.call(this,e),t.stopEvent(e)}.bind(this)),jQuery(window).bind("click.ax5combobox-"+this.instanceId,function(e){e=e||window.event,p.call(this,e),t.stopEvent(e)}.bind(this)),i.call(this,x,{self:this,state:"open",item:x}),x.onExpand&&(this.waitOptionsCallback=!0,o.call(this,x)),b=null,c=null,d=null,this))}}(),this.update=function(e){return this.bind(e),this},this.val=function(){var e={index:function(e,i,n,s){var a=this.queue[e];t.isString(i.index.gindex)?"undefined"!=typeof a.options[i.index.gindex]&&(a.options[i.index.gindex].options[i.index.index][a.columnKeys.optionSelected]=S(a,a.options[i.index.gindex].options[i.index.index][a.columnKeys.optionSelected],n),o.activecomboboxOptionGroup.find('[data-option-group-index="'+i.index.gindex+'"][data-option-index="'+i.index.index+'"]').attr("data-option-Selected",a.options[i.index.gindex].options[i.index.index][a.columnKeys.optionSelected].toString())):"undefined"!=typeof a.options[i.index.index]&&(a.options[i.index.index][a.columnKeys.optionSelected]=S(a,a.options[i.index.index][a.columnKeys.optionSelected],n),o.activecomboboxOptionGroup.find('[data-option-index="'+i.index.index+'"]').attr("data-option-Selected",a.options[i.index.index][a.columnKeys.optionSelected].toString())),("undefined"==typeof s||"justSetValue"!==s)&&($.call(this,e,a.options),x.call(this,e),u.call(this),t.selectRange(a.$displayLabel,"end"))},arr:function(i,n,s){n.forEach(function(n){if(t.isString(n)||t.isNumber(n))e.value.call(o,i,n,s,"justSetValue");else for(var a in e)if(n[a]){e[a].call(o,i,n,s,"justSetValue");break}}),$.call(this,i,this.queue[i].options),x.call(this,i),u.call(this),t.selectRange(this.queue[i].$displayLabel,"end")},value:function(e,o,i,n){var s,a=this.queue[e],l=t.search(a.options,function(){return this[a.columnKeys.optionValue]==o});l>-1?a.options[l][a.columnKeys.optionSelected]=S(a,a.options[l][a.columnKeys.optionSelected],i):(l=a.options.length,s={"@index":l,hide:!0,addedOption:!0},s[a.columnKeys.optionValue]=o,s[a.columnKeys.optionText]=o,a.options.push(s),a.options[l][a.columnKeys.optionSelected]=S(a,a.options[l][a.columnKeys.optionSelected],i)),("undefined"==typeof n||"justSetValue"!==n)&&($.call(this,e,this.queue[e].options),x.call(this,e),u.call(this),t.selectRange(this.queue[e].$displayLabel,"end"))},text:function(e,t,o,i){},clear:function(e){I.call(this,e),$.call(this,e,this.queue[e].options),b.call(this,e),v.call(this,e),this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-index]").attr("data-option-Selected","false"),this.queue[e].optionSelectedIndex=-1}};return function(o,n,s,a){var l=t.isNumber(o)?o:q.call(this,o);if(-1===l)return void console.log(ax5.info.getError("ax5combobox","402","val"));if("undefined"==typeof n)return this.queue[l].selected;if(t.isArray(n))e.clear.call(this,l),e.arr.call(this,l,this.queue[l].multiple||0==n.length?n:[n[n.length-1]],s);else if(t.isString(n)||t.isNumber(n))"undefined"==typeof n||null===n||this.queue[l].multiple||I.call(this,l),e.value.call(this,l,n,s),x.call(this,l);else if(null===n)e.clear.call(this,l),x.call(this,l);else{this.queue[l].multiple||I.call(this,l);for(var c in e)if(n[c]){e[c].call(this,l,n,s);break}x.call(this,l)}return"undefined"!=typeof n&&i.call(this,this.queue[l],{self:this,item:this.queue[l],state:a?"changeValue":"setValue",value:this.queue[l].selected,internal:a}),o=null,this}}(),this.close=function(t){return this.closeTimer&&clearTimeout(this.closeTimer),this.activecomboboxOptionGroup?(t=this.queue[this.activecomboboxQueueIndex],t.optionFocusIndex=-1,t.$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,i.call(this,t,{self:this,state:"close"})}.bind(this),e.animateTime),this.waitOptionsCallback=null,this):this},this.enable=function(e){var t=q.call(this,e);return this.queue[t].$display.removeAttr("disabled"),this.queue[t].$input.removeAttr("disabled"),i.call(this,this.queue[t],{self:this,state:"enable"}),this},this.disable=function(e){var t=q.call(this,e);return this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$input.attr("disabled","disabled"),i.call(this,this.queue[t],{self:this,state:"disable"}),this},this.main=function(){arguments&&t.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)};return e}())}(),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.val(this,arguments[1],arguments[2]);case"getValue":return ax5.ui.combobox_instance.val(this);case"enable":return ax5.ui.combobox_instance.enable(this);case"disable":return ax5.ui.combobox_instance.disable(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}}();
"use strict";!function(){var e=ax5.ui,t=ax5.util;e.addClass({className:"combobox",version:"0.2.3"},function(){var e=function(){var e,o=this;this.instanceId=ax5.getGuid(),this.config={theme:"default",animateTime:250,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,e=this.config;var i=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},n=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 '},s=function(){return'\n <div class="form-control {{formSize}} ax5combobox-display {{theme}}" \n data-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 '},a=function(){return'\n <select tabindex="-1" class="form-control {{formSize}}" name="{{name}}" {{#multiple}}multiple="multiple"{{/multiple}}></select>\n '},l=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 '},c=function(e){return'{{#selected}}<span tabindex="-1" data-ax5combobox-selected-label="{{@i}}" data-ax5combobox-selected-text="{{text}}">{{text}}</span>{{/selected}}'},d=function(){for(var e,o=this.queue.length;o--;){var i=this.queue[o];if(i.$display&&(e=Math.max(i.$select.outerWidth(),t.number(i.minWidth)),i.$display.css({"min-width":e}),i.reset&&i.$display.find(".addon-icon-reset").css({"line-height":this.queue[o].$display.height()+"px"}),i.multiple)){var n=function(){return t.number(i.$display.css("border-top-width"))+t.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 o=null,e=null,this},u=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))},p=function(e,o){if(!this.activecomboboxOptionGroup)return this;var i=this.queue[this.activecomboboxQueueIndex],n="display";return(o=t.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&&(this.val(i.id,{index:{gindex:o.getAttribute("data-option-group-index"),index:o.getAttribute("data-option-index")}},void 0,"internal"),t.selectRange(i.$displayLabel,"end"),i.multiple||this.close()),this):(this.close(),this)},r=function(e){if(e.keyCode==ax5.info.eventKeys.ESC)this.close();else if(e.which==ax5.info.eventKeys.RETURN){for(var t=[],o=this.queue[this.activecomboboxQueueIndex],i=o.$displayLabel.get(0).childNodes,n=0,s=i.length;s>n;n++){var a=i[n];if(a.nodeType in O){var l=O[a.nodeType].call(this,this.activecomboboxQueueIndex,a);"undefined"!=typeof l&&t.push(l)}}this.val(o.id,t,!0,"internal"),o.multiple||this.close()}},h=function(e){var t=this.queue[e],o={};return o.id=t.id,o.theme=t.theme,o.size="ax5combobox-option-group-"+t.size,o.multiple=t.multiple,o.lang=t.lang,o.options=t.options,o.selected=t.selected,o.hasSelected=o.selected&&o.selected.length>0,ax5.mustache.render(c.call(this,t.columnKeys),o)+"&nbsp;"},x=function(e){var o,i=this.queue[e];if(i.$displayLabel.html(h.call(this,e)),i.$target.height(""),i.$display.height(""),i.$target.height()<(o=i.$displayTable.outerHeight())){var n=function(){return t.number(i.$display.css("border-top-width"))+t.number(i.$display.css("border-bottom-width"))}();i.$target.css({height:o+n}),i.$display.css({height:o+n})}},b=function(e){this.queue[e].$displayLabel.trigger("focus"),t.selectRange(this.queue[e].$displayLabel,"end")},m=function(e,o){this.queue[e].waitOptions=!0,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,this.queue[e].columnKeys),this.queue[e]))),this.queue[e].onSearch.call({self:this,item:this.queue[e],searchWord:o},function(e){var o={},i=this.queue[this.activecomboboxQueueIndex];return i?(function(e,o){var i={};o.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),t.isArray(e.selected)&&e.selected.forEach(function(t){i[t[e.columnKeys.optionValue]]&&(o.options[i[t[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(i,e),i.options=$.call(this,this.activecomboboxQueueIndex,e.options),d.call(this),o.id=i.id,o.theme=i.theme,o.size="ax5combobox-option-group-"+i.size,o.multiple=i.multiple,o.lang=i.lang,o.options=i.options,void this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,i.columnKeys),o)))):!1}.bind(this))},f=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){m.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?g.call(this,e,void 0,i[0]["@findex"]):v.call(this,e);try{return i}finally{i=null,n=null,s=null,o=null}},v=function(e){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover").removeAttr("data-option-selected"),this.queue[e].optionFocusIndex=-1},g=function(e,o,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+o,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 o)return this;for(;c.options[n].hide;){if(n+=o,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 d=a.outerHeight(),u=l.innerHeight(),p=l.scrollTop(),r=a.position().top+l.scrollTop();if(r+d>u+p?l.scrollTop(r+d-u):p>r&&l.scrollTop(r),"undefined"!=typeof o){var h=c.$displayLabel.get(0).childNodes,x=h[h.length-1];if("1"!=x.nodeType&&(x=h[h.length-2]),!x)return this;x.getAttribute("data-ax5combobox-selected-text")||(x.innerHTML="&nbsp;"+c.indexedOptions[n].text,t.selectRange(c.$displayLabel,"end"))}}}},y=function(){var e=t.debounce(function(e){if(-1==this.activecomboboxQueueIndex)return this;for(var i=[],n="",s=this.queue[e],a=s.$displayLabel.get(0).childNodes,l=0,c=a.length;c>l;l++){var d=a[l];if(d.nodeType in O){var u=O[d.nodeType].call(this,this.activecomboboxQueueIndex,d,!0);"undefined"==typeof u||(t.isString(u)?(n=u,"1"==d.nodeType&&d.getAttribute("data-ax5combobox-selected-text")?n=!1:i.push(u)):i.push(u))}}0==a.length?this.val(s.id,null,void 0,"internal"):n===!1?(this.val(s.id,i,void 0,"internal"),t.selectRange(s.$displayLabel,"end")):""!=n&&f.call(o,e,n)},150),i=function(e){for(var o,i=[],n=this.queue[e],s=n.$displayLabel.get(0).childNodes,a=0,l=s.length;l>a;a++){var c=s[a];if(c.nodeType in O){var d=O[c.nodeType].call(this,e,c,!0);"undefined"==typeof d||(t.isString(d)?(o=d,i.push(d)):i.push(d))}}"undefined"!=typeof o&&this.val(n.id,i,void 0,"internal")},n={click:function(e,i){var n=t.findParentNode(i.target,function(e){return e.getAttribute("data-selected-clear")?!0:void 0});n?this.val(e,{clear:!0}):o.activecomboboxQueueIndex==e?-1==this.queue[e].optionFocusIndex&&o.close():(o.open(e),""==this.queue[e].$displayLabel.text().replace(/^\W*|\W*$/g,"")&&(this.queue[e].$displayLabel.html(h.call(this,e)),b.call(this,e)))},keyUp:function(i,n){return n.which==ax5.info.eventKeys.ESC&&-1===o.activecomboboxQueueIndex?(t.stopEvent(n),this):(o.activecomboboxQueueIndex!=i&&(o.open(i),t.stopEvent(n)),void e.call(this,i))},keyDown:function(e,o){o.which==ax5.info.eventKeys.ESC?t.stopEvent(o):o.which==ax5.info.eventKeys.RETURN?t.stopEvent(o):o.which==ax5.info.eventKeys.DOWN?(g.call(this,e,1),t.stopEvent(o)):o.which==ax5.info.eventKeys.UP&&(g.call(this,e,-1),t.stopEvent(o))},focus:function(e,t){},blur:function(e,o){i.call(this,e),t.stopEvent(o)},selectChange:function(e,t){this.val(e,this.queue[e].$select.val(),!0)}};return function(e){var t=this.queue[e],o={};return t.selected=[],t.$display?(t.$displayLabel.html(h.call(this,e)),t.options=$.call(this,e,t.options),d.call(this)):(o.instanceId=this.instanceId,o.id=t.id,o.name=t.name,o.theme=t.theme,o.tabIndex=t.tabIndex,o.multiple=t.multiple,o.reset=t.reset,o.label=h.call(this,e),o.formSize=function(){return t.size?"input-"+t.size:""}(),t.$display=jQuery(ax5.mustache.render(s.call(this,e),o)),t.$displayTable=t.$display.find('[data-els="display-table"]'),t.$displayLabel=t.$display.find('[data-ax5combobox-display="label"]'),t.$target.find("select").get(0)?(t.$select=t.$target.find("select"),t.$select.attr("tabindex","-1").attr("class","form-control "+o.formSize),o.name&&t.$select.attr("name","name"),o.multiple&&t.$select.attr("multiple","multiple")):(t.$select=jQuery(ax5.mustache.render(a.call(this,e),o)),t.$target.append(t.$select)),t.$target.append(t.$display),t.options=$.call(this,e,t.options),d.call(this)),t.$display.unbind("click.ax5combobox").bind("click.ax5combobox",n.click.bind(this,e)),t.$displayLabel.unbind("focus.ax5combobox").bind("focus.ax5combobox",n.focus.bind(this,e)).unbind("blur.ax5combobox").bind("blur.ax5combobox",n.blur.bind(this,e)).unbind("keyup.ax5combobox").bind("keyup.ax5combobox",n.keyUp.bind(this,e)).unbind("keydown.ax5combobox").bind("keydown.ax5combobox",n.keyDown.bind(this,e)),t.$select.unbind("change.ax5combobox").bind("change.ax5combobox",n.selectChange.bind(this,e)),o=null,t=null,e=null,this}}(),$=function(){var e=function(e,t){t?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected=[]};return function(i,n){var s,a,l,c=this.queue[i],d=0;return e.call(this,i,!1),n?(c.options=n,c.indexedOptions=[],s=[],s.push('<option value=""></option>'),c.options.forEach(function(t,n){t.optgroup?(t["@gindex"]=n,t.options.forEach(function(t,a){t["@index"]=a,t["@findex"]=d,s.push('<option value="'+t[c.columnKeys.optionValue]+'" '+(t[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+t[c.columnKeys.optionText]+"</option>"),t[c.columnKeys.optionSelected]&&e.call(o,i,t),c.indexedOptions.push({"@gindex":n,"@index":a,"@findex":d,value:t[c.columnKeys.optionValue],text:t[c.columnKeys.optionText]}),d++})):(t["@index"]=n,t["@findex"]=d,s.push('<option value="'+t[c.columnKeys.optionValue]+'" '+(t[c.columnKeys.optionSelected]?' selected="selected"':"")+">"+t[c.columnKeys.optionText]+"</option>"),t[c.columnKeys.optionSelected]&&e.call(o,i,t),c.indexedOptions.push({"@index":n,"@findex":d,value:t[c.columnKeys.optionValue],text:t[c.columnKeys.optionText]}),d++)}),c.optionItemLength=d,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=t.toArray(c.$select.get(0).options),l=[],a.forEach(function(t,n){var s={};s[c.columnKeys.optionValue]=t.value,s[c.columnKeys.optionText]=t.text,s[c.columnKeys.optionSelected]=t.selected,s["@index"]=n,s["@findex"]=d,t.selected&&e.call(o,i,s),l.push(s),d++,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}}(),q=function(e){return t.isString(e)||(e=jQuery(e).data("data-ax5combobox-id")),t.isString(e)?t.search(this.queue,function(){return this.id==e}):void console.log(ax5.info.getError("ax5combobox","402","getQueIdx"))},S=function(e,t,o){return"undefined"==typeof o?e.multiple?!t:!0:o},I=function(e){this.queue[e].options.forEach(function(e){e.optgroup?e.options.forEach(function(e){e.selected=!1}):e.selected=!1})},O={1:function(t,o,i){var n,s,a=(o.textContent||o.innerText).replace(/^[\s\r\n\t]*|[\s\r\n\t]*$/g,""),l=this.queue[t];if(l.selected&&l.selected.length>0&&o.getAttribute("data-ax5combobox-selected-text")==a)return n=o.getAttribute("data-ax5combobox-selected-label"),s=l.selected[n],{index:{gindex:s["@gindex"],index:s["@index"],value:s[e.columnKeys.optionValue]}};if(o.getAttribute("data-ax5combobox-selected-text"))return a;if(""!=a){var s;return l.optionFocusIndex>-1&&(s=l.indexedOptions[l.optionFocusIndex])&&s[e.columnKeys.optionText].substr(0,a.length)===a?{index:{gindex:s["@gindex"],index:s["@index"],value:s[e.columnKeys.optionValue]}}:this.queue[t].editable||i?a:void 0}},3:function(e,t,o){var i=(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}}};this.init=function(){this.onStateChanged=e.onStateChanged,this.onChange=e.onChange,jQuery(window).bind("resize.ax5combobox-display-"+this.instanceId,function(){d.call(this)}.bind(this))},this.bind=function(o){var i,n={};return o=jQuery.extend(!0,n,e,o),o.target?(o.$target=jQuery(o.target),o.id||(o.id=o.$target.data("data-ax5combobox-id")),o.id||(o.id="ax5combobox-"+ax5.getGuid(),o.$target.data("data-ax5combobox-id",o.id)),o.name=o.$target.attr("data-ax5combobox"),o.options&&(o.options=JSON.parse(JSON.stringify(o.options))),function(e){t.isObject(e)&&!e.error&&(o=jQuery.extend(!0,o,e))}(t.parseJson(o.$target.attr("data-ax5combobox-config"),!0)),i=t.search(this.queue,function(){return this.id==o.id}),-1===i?(this.queue.push(o),y.call(this,this.queue.length-1)):(this.queue[i]=jQuery.extend(!0,{},this.queue[i],o),y.call(this,i)),n=null,i=null,this):(console.log(ax5.info.getError("ax5combobox","401","bind")),this)},this.open=function(){var o=function(e){e.onExpand.call({self:this,item:e},function(e){if(this.waitOptionsCallback){var o={},i=this.queue[this.activecomboboxQueueIndex];!function(e,o){var i={};o.options.forEach(function(t,o){t["@index"]=o,i[t[e.columnKeys.optionValue]]=t}),t.isArray(e.selected)&&e.selected.forEach(function(t){i[t[e.columnKeys.optionValue]]&&(o.options[i[t[e.columnKeys.optionValue]]["@index"]][e.columnKeys.optionSelected]=!0)})}(i,e),i.$display.find('[data-ax5combobox-display="label"]').html(h.call(this,this.activecomboboxQueueIndex)),i.options=$.call(this,this.activecomboboxQueueIndex,e.options),d.call(this),o.id=i.id,o.theme=i.theme,o.size="ax5combobox-option-group-"+i.size,o.multiple=i.multiple,o.lang=i.lang,o.options=i.options,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,i.columnKeys),o)))}}.bind(this))};return function(s,a){this.waitOptionsCallback=null;var c,d,h=t.isNumber(s)?s:q.call(this,s),x=this.queue[h],b={};return x.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activecomboboxOptionGroup?this.activecomboboxQueueIndex==h?this:a>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(h,(a||0)+1)}.bind(this),e.animateTime),this):(x.optionFocusIndex=-1,x.selected&&x.selected.length>0&&(x.optionSelectedIndex=x.selected[0]["@findex"]),b.id=x.id,b.theme=x.theme,b.size="ax5combobox-option-group-"+x.size,b.multiple=x.multiple,b.lang=x.lang,x.$display.attr("data-combobox-option-group-opened","true"),x.onExpand&&(b.waitOptions=!0),b.options=t.filter(x.options,function(){return!this.hide}),this.activecomboboxOptionGroup=jQuery(ax5.mustache.render(n.call(this,x.columnKeys),b)),this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(ax5.mustache.render(l.call(this,x.columnKeys),b))),this.activecomboboxQueueIndex=h,u.call(this,"append"),jQuery(window).bind("resize.ax5combobox-"+this.instanceId,function(){u.call(this)}.bind(this)),x.selected&&x.selected.length>0&&(d=this.activecomboboxOptionGroup.find('[data-option-index="'+x.selected[0]["@index"]+'"]'),d.get(0)&&(c=d.position().top-this.activecomboboxOptionGroup.height()/3,this.activecomboboxOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:c},x.animateTime,"swing",function(){}))),jQuery(window).bind("keyup.ax5combobox-"+this.instanceId,function(e){e=e||window.event,r.call(this,e),t.stopEvent(e)}.bind(this)),jQuery(window).bind("click.ax5combobox-"+this.instanceId,function(e){e=e||window.event,p.call(this,e),t.stopEvent(e)}.bind(this)),i.call(this,x,{self:this,state:"open",item:x}),x.onExpand&&(this.waitOptionsCallback=!0,o.call(this,x)),b=null,c=null,d=null,this))}}(),this.update=function(e){return this.bind(e),this},this.val=function(){var e={index:function(e,i,n,s){var a=this.queue[e];t.isString(i.index.gindex)?"undefined"!=typeof a.options[i.index.gindex]&&(a.options[i.index.gindex].options[i.index.index][a.columnKeys.optionSelected]=S(a,a.options[i.index.gindex].options[i.index.index][a.columnKeys.optionSelected],n),o.activecomboboxOptionGroup.find('[data-option-group-index="'+i.index.gindex+'"][data-option-index="'+i.index.index+'"]').attr("data-option-Selected",a.options[i.index.gindex].options[i.index.index][a.columnKeys.optionSelected].toString())):"undefined"!=typeof a.options[i.index.index]&&(a.options[i.index.index][a.columnKeys.optionSelected]=S(a,a.options[i.index.index][a.columnKeys.optionSelected],n),o.activecomboboxOptionGroup.find('[data-option-index="'+i.index.index+'"]').attr("data-option-Selected",a.options[i.index.index][a.columnKeys.optionSelected].toString())),("undefined"==typeof s||"justSetValue"!==s)&&($.call(this,e,a.options),x.call(this,e),u.call(this),t.selectRange(a.$displayLabel,"end"))},arr:function(i,n,s){n.forEach(function(n){if(t.isString(n)||t.isNumber(n))e.value.call(o,i,n,s,"justSetValue");else for(var a in e)if(n[a]){e[a].call(o,i,n,s,"justSetValue");break}}),$.call(this,i,this.queue[i].options),x.call(this,i),u.call(this),t.selectRange(this.queue[i].$displayLabel,"end")},value:function(e,o,i,n){var s,a=this.queue[e],l=t.search(a.options,function(){return this[a.columnKeys.optionValue]==o});l>-1?a.options[l][a.columnKeys.optionSelected]=S(a,a.options[l][a.columnKeys.optionSelected],i):(l=a.options.length,s={"@index":l,hide:!0,addedOption:!0},s[a.columnKeys.optionValue]=o,s[a.columnKeys.optionText]=o,a.options.push(s),a.options[l][a.columnKeys.optionSelected]=S(a,a.options[l][a.columnKeys.optionSelected],i)),("undefined"==typeof n||"justSetValue"!==n)&&($.call(this,e,this.queue[e].options),x.call(this,e),u.call(this),t.selectRange(this.queue[e].$displayLabel,"end"))},text:function(e,t,o,i){},clear:function(e){I.call(this,e),$.call(this,e,this.queue[e].options),b.call(this,e),v.call(this,e),this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-index]").attr("data-option-Selected","false"),this.queue[e].optionSelectedIndex=-1}};return function(o,n,s,a){var l=t.isNumber(o)?o:q.call(this,o);if(-1===l)return void console.log(ax5.info.getError("ax5combobox","402","val"));if("undefined"==typeof n)return this.queue[l].selected;if(t.isArray(n))e.clear.call(this,l),e.arr.call(this,l,this.queue[l].multiple||0==n.length?n:[n[n.length-1]],s);else if(t.isString(n)||t.isNumber(n))"undefined"==typeof n||null===n||this.queue[l].multiple||I.call(this,l),e.value.call(this,l,n,s),x.call(this,l);else if(null===n)e.clear.call(this,l),x.call(this,l);else{this.queue[l].multiple||I.call(this,l);for(var c in e)if(n[c]){e[c].call(this,l,n,s);break}x.call(this,l)}return"undefined"!=typeof n&&i.call(this,this.queue[l],{self:this,item:this.queue[l],state:a?"changeValue":"setValue",value:this.queue[l].selected,internal:a}),o=null,this}}(),this.close=function(t){return this.closeTimer&&clearTimeout(this.closeTimer),this.activecomboboxOptionGroup?(t=this.queue[this.activecomboboxQueueIndex],t.optionFocusIndex=-1,t.$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,i.call(this,t,{self:this,state:"close"})}.bind(this),e.animateTime),this.waitOptionsCallback=null,this):this},this.enable=function(e){var t=q.call(this,e);return this.queue[t].$display.removeAttr("disabled"),this.queue[t].$input.removeAttr("disabled"),i.call(this,this.queue[t],{self:this,state:"enable"}),this},this.disable=function(e){var t=q.call(this,e);return this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$input.attr("disabled","disabled"),i.call(this,this.queue[t],{self:this,state:"disable"}),this},this.main=function(){arguments&&t.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)};return e}())}(),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.val(this,arguments[1],arguments[2]);case"getValue":return ax5.ui.combobox_instance.val(this);case"enable":return ax5.ui.combobox_instance.enable(this);case"disable":return ax5.ui.combobox_instance.disable(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}}();
{
"name": "ax5ui-combobox",
"version": "0.2.2",
"version": "0.2.3",
"description": "A combobox plugin that works with Bootstrap & jQuery",

@@ -5,0 +5,0 @@ "license": "LGPLv3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc