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 1.4.125 to 1.4.126

2

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

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

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

"use strict";!function(){var e=ax5.ui,t=ax5.util,o=void 0;e.addClass({className:"combobox"},function(){return function(){var e,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,e=this.config;var n=jQuery(window),s=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},a=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+4}),i.$display.css({height:s+n+4}))}}return o=null,e=null,this},l=function(e){if(!this.activecomboboxOptionGroup)return this;var t,o=this.queue[this.activecomboboxQueueIndex],i={},s=0,a={},l={};e&&jQuery(document.body).append(this.activecomboboxOptionGroup),i=o.$target.offset(),a={width:o.$target.outerWidth(),height:o.$target.outerHeight()},l={winWidth:Math.max(n.width(),jQuery(document.body).width()),winHeight:Math.max(n.height(),jQuery(document.body).height()),width:this.activecomboboxOptionGroup.outerWidth(),height:this.activecomboboxOptionGroup.outerHeight()},o.direction&&""!==o.direction&&"auto"!==o.direction?t=o.direction:(t="top",i.top-l.height-s<0?t="top":i.top+a.height+l.height+s>l.winHeight&&(t="bottom")),e&&this.activecomboboxOptionGroup.addClass("direction-"+t),this.activecomboboxOptionGroup.css(function(){if("top"==t){if(i.top+a.height+l.height+s>l.winHeight){var e=i.top+a.height/2-l.height/2;return e+l.height+s>l.winHeight&&(e=0),e<0&&(e=0),{left:i.left,top:e,width:a.width}}return{left:i.left,top:i.top+a.height+1,width:a.width}}if("bottom"==t)return{left:i.left,top:i.top-l.height-1,width:a.width}}.call(this))},c=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&&($.call(this,i.id,{index:{gindex:o.getAttribute("data-option-group-index"),index:o.getAttribute("data-option-index")}},void 0,!0),a.call(this),l.call(this),i.multiple||this.close()),this):(this.close(),this)},u=function(e){var t=this.queue[e],i={};return i.id=t.id,i.theme=t.theme,i.size="ax5combobox-option-group-"+t.size,i.multiple=t.multiple,i.lang=t.lang,i.options=t.options,i.selected=t.selected,i.hasSelected=i.selected&&i.selected.length>0,i.removeIcon=t.removeIcon,o.tmpl.get.call(this,"label",i,t.columnKeys)},d=function(e){var t=this.queue[e];t.$displayLabel.find("[data-ax5combobox-selected-label]").remove(),t.$displayLabelInput.before(u.call(this,e))},p=function(e){return this.queue[e].disabled?this:(this.queue[e].$displayLabel.trigger("focus"),void this.queue[e].$displayLabelInput.focus())},r=function(e){this.queue[e].$displayLabelInput.val("")},h=function(e){this.queue[e].$displayLabel.trigger("blur"),this.queue[e].$displayLabelInput.trigger("blur")},x=function(e,i){this.queue[e].waitOptions=!0,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(o.tmpl.get.call(this,"option",this.queue[e],this.queue[e].columnKeys))),this.queue[e].onSearch.call({self:this,item:this.queue[e],searchWord:i},function(e){var i={},n=this.queue[this.activecomboboxQueueIndex];return!!n&&(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)})}(n,e),n.options=v.call(this,this.activecomboboxQueueIndex,e.options),a.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,void this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(o.tmpl.get.call(this,"options",i,n.columnKeys))))}.bind(this))},b=function(e,t){if(this.activecomboboxQueueIndex==-1)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){x.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?f.call(this,e,void 0,i[0]["@findex"]):m.call(this,e);try{return i}finally{i=null,n=null,s=null,o=null}},m=function(e){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover").removeAttr("data-option-selected"),this.queue[e].optionFocusIndex=-1},f=function(e,t,o){var i,n,s,a,l=this.queue[e];if(this.activecomboboxOptionGroup&&l.options&&l.options.length>0){if("undefined"!=typeof o?i=o:(n=l.optionFocusIndex==-1?l.optionSelectedIndex||-1:l.optionFocusIndex,n==-1?i=0:(i=n+t,i<0?i=0:i>l.optionItemLength-1&&(i=l.optionItemLength-1))),l.optionFocusIndex=i,l.options[i]&&l.options[i].hide){if("undefined"==typeof t)return this;for(;l.options[i].hide;){if(i+=t,i<0){i=0;break}if(i>l.optionItemLength-1){i=l.optionItemLength-1;break}}}if("undefined"!=typeof i&&(this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover"),s=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+i+'"]').addClass("hover"),a=this.activecomboboxOptionGroup.find('[data-els="content"]'),s.get(0))){var c=s.outerHeight(),u=a.innerHeight(),d=a.scrollTop(),p=s.position().top+a.scrollTop();u+d<p+c?a.scrollTop(p+c-u):d>p&&a.scrollTop(p),"undefined"!=typeof t&&l.$displayLabelInput.val(l.options[i].text)}}},v=function(){var e=function(e,t){t?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected=[]};return function(o,n){var s,a,l,c=this.queue[o],u=0;return e.call(this,o,!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"]=u,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(i,o,t),c.indexedOptions.push({"@gindex":n,"@index":a,"@findex":u,value:t[c.columnKeys.optionValue],text:t[c.columnKeys.optionText]}),u++})):(t["@index"]=n,t["@findex"]=u,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(i,o,t),c.indexedOptions.push({"@index":n,"@findex":u,value:t[c.columnKeys.optionValue],text:t[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=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"]=u,t.selected&&e.call(i,o,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}}(),g=function(e){return e instanceof jQuery?e=e.data("data-ax5combobox-id"):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"))},y=function(e,t,o){return"undefined"==typeof o?!e.multiple||!t:o},S=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,o,n,s){var a=this.queue[e];t.isString(o.index.gindex)?"undefined"!=typeof a.options[o.index.gindex]&&(a.options[o.index.gindex].options[o.index.index][a.columnKeys.optionSelected]=y(a,a.options[o.index.gindex].options[o.index.index][a.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-group-index="'+o.index.gindex+'"][data-option-index="'+o.index.index+'"]').attr("data-option-Selected",a.options[o.index.gindex].options[o.index.index][a.columnKeys.optionSelected].toString())):"undefined"!=typeof a.options[o.index.index]&&(a.options[o.index.index][a.columnKeys.optionSelected]=y(a,a.options[o.index.index][a.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-index="'+o.index.index+'"]').attr("data-option-Selected",a.options[o.index.index][a.columnKeys.optionSelected].toString())),"undefined"!=typeof s&&"justSetValue"===s||(v.call(this,e,a.options),l.call(this))},arr:function(o,n,s,a){n.forEach(function(n){if(t.isString(n)||t.isNumber(n))e.text.call(i,o,n,s,"justSetValue");else for(var a in e)if(n[a]){e[a].call(i,o,n,s,"justSetValue");break}}),v.call(this,o,this.queue[o].options),l.call(this)},value:function(e,o,i,n){var s,a=this.queue[e],c=t.search(a.options,function(){return this[a.columnKeys.optionValue]==o[a.columnKeys.optionValue]});c>-1?a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i):(c=a.options.length,s={"@index":c,hide:!0,addedOption:!0},s[a.columnKeys.optionValue]=o,s[a.columnKeys.optionText]=o,a.options.push(s),a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i)),"undefined"!=typeof n&&"justSetValue"===n||(v.call(this,e,this.queue[e].options),l.call(this))},text:function(e,o,i,n){var s,a=this.queue[e],c=t.search(a.options,function(){return this[a.columnKeys.optionText]==o});c>-1?a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i):(c=a.options.length,s={"@index":c,hide:!0,addedOption:!0},s[a.columnKeys.optionValue]=o,s[a.columnKeys.optionText]=o,a.options.push(s),a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i)),"undefined"!=typeof n&&"justSetValue"===n||(v.call(this,e,this.queue[e].options),l.call(this))},clear:function(e){S.call(this,e),v.call(this,e,this.queue[e].options),m.call(this,e),this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-index]").attr("data-option-Selected","false"),this.queue[e].optionSelectedIndex=-1}};return function(o,i,n,a){var l=t.isNumber(o)?o:g.call(this,o);if(l===-1)return void console.log(ax5.info.getError("ax5combobox","402","val"));if("undefined"==typeof i)throw"error not found value";if(t.isArray(i))e.clear.call(this,l),e.arr.call(this,l,this.queue[l].multiple||0==i.length?i:[i[i.length-1]],n);else if(t.isString(i)||t.isNumber(i))"undefined"==typeof i||null===i||this.queue[l].multiple||S.call(this,l),e.text.call(this,l,i,n,"justSetValue");else if(null===i)e.clear.call(this,l);else{this.queue[l].multiple||S.call(this,l);for(var c in e)if(i[c]){e[c].call(this,l,i,n,"justSetValue");break}}return v.call(this,l,this.queue[l].options),d.call(this,l),p.call(this,l),"undefined"!=typeof i&&a&&!a.noStateChange&&s.call(this,this.queue[l],{self:this,item:this.queue[l],state:"changeValue",value:this.queue[l].selected}),o=null,this}}();this.init=function(){this.onStateChanged=e.onStateChanged,this.onChange=e.onChange,jQuery(window).on("resize.ax5combobox-display-"+this.instanceId,function(){a.call(this)}.bind(this))},this.bind=function(n){var s,c=function(){var e=t.debounce(function(e){return this.activecomboboxQueueIndex==-1?this:void b.call(i,e,this.queue[e].$displayLabelInput.val())},150),s=function(e){r.call(this,e)},c={click:function(e,o){var n,s=t.findParentNode(o.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 c=s.getAttribute("data-ax5combobox-remove-index"),u=this.queue[e].selected[c];return $.call(this,e,{index:{gindex:u["@gindex"],index:u["@index"]}},!1,!0),a.call(this),l.call(this),p.call(this,e),t.stopEvent(o),this}"clear"===n&&($.call(this,e,{clear:!0}),a.call(this),l.call(this),p.call(this,e))}else i.activecomboboxQueueIndex==e?this.queue[e].optionFocusIndex==-1&&i.close():(i.open(e),p.call(this,e))},keyUp:function(o,n){if(n.which==ax5.info.eventKeys.ESC&&i.activecomboboxQueueIndex===-1)return t.stopEvent(n),this;i.activecomboboxQueueIndex!=o&&(i.open(o),t.stopEvent(n));var s={40:"KEY_DOWN",38:"KEY_UP"};if(!s[n.which])if(n.which==ax5.info.eventKeys.BACKSPACE&&""==this.queue[o].$displayLabelInput.val()){if(this.queue[o].selected.length>0){var c=this.queue[o].selected[this.queue[o].selected.length-1];$.call(this,o,{index:{gindex:c["@gindex"],index:c["@index"]}},!1,!0)}a.call(this),l.call(this),t.stopEvent(n)}else e.call(this,o)},keyDown:function(e,o){o.which==ax5.info.eventKeys.ESC?(r.call(this,e),this.close(),t.stopEvent(o)):o.which==ax5.info.eventKeys.RETURN?($.call(this,n.id,{index:{gindex:n.indexedOptions[n.optionFocusIndex]["@gindex"],index:n.indexedOptions[n.optionFocusIndex]["@index"]}},void 0,!0),r.call(this,e),a.call(this),this.close(),t.stopEvent(o)):o.which==ax5.info.eventKeys.DOWN?(f.call(this,e,1),t.stopEvent(o)):o.which==ax5.info.eventKeys.UP&&(f.call(this,e,-1),t.stopEvent(o))},focus:function(e,t){},blur:function(e,o){s.call(this,e),t.stopEvent(o)},selectChange:function(e,t){$.call(this,e,{value:this.queue[e].$select.val()},!0)}};return function(e){var t=this.queue[e],i={};return t.selected=[],t.$display?(t.$displayLabel.html(u.call(this,e)),t.options=v.call(this,e,t.options)):(i.instanceId=this.instanceId,i.id=t.id,i.name=t.name,i.theme=t.theme,i.tabIndex=t.tabIndex,i.multiple=t.multiple,i.reset=t.reset,i.label=u.call(this,e),i.formSize=function(){return t.size?"input-"+t.size:""}(),t.$display=jQuery(o.tmpl.get.call(this,"comboboxDisplay",i,t.columnKeys)),t.$displayTable=t.$display.find('[data-els="display-table"]'),t.$displayLabel=t.$display.find('[data-ax5combobox-display="label"]'),t.$displayLabelInput=t.$display.find('[data-ax5combobox-display="input"]'),t.$target.find("select").get(0)?(t.$select=t.$target.find("select"),t.$select.attr("tabindex","-1").attr("class","form-control "+i.formSize),i.name&&t.$select.attr("name","name"),i.multiple&&t.$select.attr("multiple","multiple")):(t.$select=jQuery(o.tmpl.get.call(this,"formSelect",i,t.columnKeys)),t.$target.append(t.$select)),t.$target.append(t.$display),t.options=v.call(this,e,t.options)),a.call(this),t.$display.off("click.ax5combobox").on("click.ax5combobox",c.click.bind(this,e)),t.$displayLabelInput.off("focus.ax5combobox").on("focus.ax5combobox",c.focus.bind(this,e)).off("blur.ax5combobox").on("blur.ax5combobox",c.blur.bind(this,e)).off("keyup.ax5combobox").on("keyup.ax5combobox",c.keyUp.bind(this,e)).off("keydown.ax5combobox").on("keydown.ax5combobox",c.keyDown.bind(this,e)),t.$select.off("change.ax5combobox").on("change.ax5combobox",c.selectChange.bind(this,e)),i=null,t=null,e=null,this}}(),d={};return n=jQuery.extend(!0,d,e,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){t.isObject(e)&&!e.error&&(n=jQuery.extend(!0,n,e))}(t.parseJson(n.$target.attr("data-ax5combobox-config"),!0)),s=t.search(this.queue,function(){return this.id==n.id}),s===-1?(this.queue.push(n),c.call(this,this.queue.length-1)):(this.queue[s]=jQuery.extend(!0,{},this.queue[s],n),c.call(this,s)),d=null,s=null,this):(console.log(ax5.info.getError("ax5combobox","401","bind")),this)},this.open=function(){var i=function(e){e.onExpand.call({self:this,item:e},function(e){if(this.waitOptionsCallback){var i={},n=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)})}(n,e),n.options=v.call(this,this.activecomboboxQueueIndex,e.options),d.call(this,this.activecomboboxQueueIndex),a.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(o.tmpl.get.call(this,"options",i,n.columnKeys)))}}.bind(this))};return function(n,a){this.waitOptionsCallback=null;var u,d,p=t.isNumber(n)?n:g.call(this,n),r=this.queue[p],h={};return r.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activecomboboxOptionGroup?this.activecomboboxQueueIndex==p?this:a>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(p,(a||0)+1)}.bind(this),e.animateTime),this):(r.optionFocusIndex=-1,r.selected&&r.selected.length>0&&(r.optionSelectedIndex=r.selected[0]["@findex"]),h.id=r.id,h.theme=r.theme,h.size="ax5combobox-option-group-"+r.size,h.multiple=r.multiple,h.lang=r.lang,r.$display.attr("data-combobox-option-group-opened","true"),r.onExpand&&(h.waitOptions=!0),h.options=t.filter(r.options,function(){return!this.hide}),this.activecomboboxOptionGroup=jQuery(o.tmpl.get.call(this,"optionGroup",h,r.columnKeys)),this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(o.tmpl.get.call(this,"options",h,r.columnKeys))),this.activecomboboxQueueIndex=p,l.call(this,"append"),jQuery(window).on("resize.ax5combobox-"+this.instanceId,function(){l.call(this)}.bind(this)),r.selected&&r.selected.length>0&&(d=this.activecomboboxOptionGroup.find('[data-option-index="'+r.selected[0]["@index"]+'"]'),d.get(0)&&(u=d.position().top-this.activecomboboxOptionGroup.height()/3,this.activecomboboxOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:u},r.animateTime,"swing",function(){}))),jQuery(window).on("click.ax5combobox-"+this.instanceId,function(e){e=e||window.event,c.call(this,e),t.stopEvent(e)}.bind(this)),s.call(this,r,{self:this,state:"open",item:r}),r.onExpand&&(this.waitOptionsCallback=!0,i.call(this,r)),h=null,u=null,d=null,this))}}(),this.update=function(e){return this.bind(e),this},this.setValue=function(e,o,i){var n=t.isNumber(e)?e:g.call(this,e);if(n===-1)return void console.log(ax5.info.getError("ax5combobox","402","val"));if(S.call(this,n),t.isArray(o)){var s=t.map(o,function(){return{value:this}});$.call(this,n,s,i||!0,{noStateChange:!0})}else t.isString(o)||t.isNumber(o)?$.call(this,n,{value:o},i||!0,{noStateChange:!0}):d.call(this,n);return h.call(this,n),a.call(this),this},this.setText=function(e,o,i){var n=t.isNumber(e)?e:g.call(this,e);return n===-1?void console.log(ax5.info.getError("ax5combobox","402","val")):(S.call(this,n),$.call(this,n,o,!0,{noStateChange:!0}),h.call(this,n),a.call(this),this)},this.getSelectedOption=function(e){var o=t.isNumber(e)?e:g.call(this,e);return o===-1?void console.log(ax5.info.getError("ax5combobox","402","val")):t.deepCopy(this.queue[o].selected)},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"),t.$displayLabel.attr("contentEditable","false"),this.activecomboboxOptionGroup.addClass("destroy"),jQuery(window).off("resize.ax5combobox-"+this.instanceId).off("click.ax5combobox-"+this.instanceId).off("keyup.ax5combobox-"+this.instanceId),this.closeTimer=setTimeout(function(){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.remove(),this.activecomboboxOptionGroup=null,this.activecomboboxQueueIndex=-1,s.call(this,t,{self:this,state:"close"})}.bind(this),e.animateTime),this.waitOptionsCallback=null,this):this},this.blur=function(e){var o=t.isNumber(e)?e:g.call(this,e);return o===-1?void console.log(ax5.info.getError("ax5combobox","402","val")):(h.call(this,o),this)},this.enable=function(e){var t=g.call(this,e);return"undefined"!=typeof t&&(this.queue[t].disabled=!1,this.queue[t].$display[0]&&(this.queue[t].$display.removeAttr("disabled"),this.queue[t].$displayLabelInput.removeAttr("disabled")),this.queue[t].$select[0]&&this.queue[t].$select.removeAttr("disabled"),s.call(this,this.queue[t],{self:this,state:"enable"})),this},this.disable=function(e){var t=g.call(this,e);return"undefined"!=typeof t&&(this.queue[t].disabled=!0,this.queue[t].$display[0]&&(this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$displayLabelInput.attr("disabled","disabled")),this.queue[t].$select[0]&&this.queue[t].$select.attr("disabled","disabled"),s.call(this,this.queue[t],{self:this,state:"disable"})),this},this.align=function(){return a.call(this),this},this.clear=function(e){var o=t.isNumber(e)?e:g.call(this,e);return o===-1?void console.log(ax5.info.getError("ax5combobox","402","clear")):(S.call(this,o),$.call(this,o,[],!1,{noStateChange:!1}),d.call(this,o),h.call(this,o),a.call(this),this)},this.main=function(){arguments&&t.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)}}()),o=ax5.ui.combobox}(),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}}{{/tabIndex}}{{#tabIndex}}tabindex="{{tabIndex}}" {{/tabIndex}}\n data-ax5combobox-display="label"\n spellcheck="false"><input type="text"data-ax5combobox-display="input" style="border:0 none;" /></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</div>\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{{#selected}}\n<option value="{{'+e.optionValue+'}}" selected="true">{{'+e.optionText+"}}</option>\n{{/selected}}\n"},s=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 '},a=function(e){return'{{#selected}}<div tabindex="-1" data-ax5combobox-selected-label="{{@i}}" data-ax5combobox-selected-text="{{text}}"><div data-ax5combobox-remove="true" \ndata-ax5combobox-remove-index="{{@i}}">{{{removeIcon}}}</div><span>{{'+e.optionText+"}}</span></div>{{/selected}}"};e.tmpl={comboboxDisplay:o,formSelect:i,formSelectOptions:n,optionGroup:t,options:s,label:a,get:function(t,o,i){return ax5.mustache.render(e.tmpl[t].call(this,i),o)}}}(),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){if(o)return l;var u;return c.optionFocusIndex>-1&&(u=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+c.optionFocusIndex+'"]')),c.optionFocusIndex>-1&&u.get(0)&&u.attr("data-option-value")?{index:{gindex:u.attr("data-option-group-index"),index:u.attr("data-option-index")}}:c.editable?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){if(o)return 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?i:void 0}}});e.util={nodeTypeProcessor:t}}(),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);case"clear":return ax5.ui.combobox_instance.clear(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,o=void 0;e.addClass({className:"combobox"},function(){return function(){var e,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,e=this.config;var n=jQuery(window),s=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},a=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+4}),i.$display.css({height:s+n+4}))}}return o=null,e=null,this},l=function(e){if(!this.activecomboboxOptionGroup)return this;var t,o=this.queue[this.activecomboboxQueueIndex],i={},s=0,a={},l={};e&&jQuery(document.body).append(this.activecomboboxOptionGroup),i=o.$target.offset(),a={width:o.$target.outerWidth(),height:o.$target.outerHeight()},l={winWidth:Math.max(n.width(),jQuery(document.body).width()),winHeight:Math.max(n.height(),jQuery(document.body).height()),width:this.activecomboboxOptionGroup.outerWidth(),height:this.activecomboboxOptionGroup.outerHeight()},o.direction&&""!==o.direction&&"auto"!==o.direction?t=o.direction:(t="top",i.top-l.height-s<0?t="top":i.top+a.height+l.height+s>l.winHeight&&(t="bottom")),e&&this.activecomboboxOptionGroup.addClass("direction-"+t),this.activecomboboxOptionGroup.css(function(){if("top"==t){if(i.top+a.height+l.height+s>l.winHeight){var e=i.top+a.height/2-l.height/2;return e+l.height+s>l.winHeight&&(e=0),e<0&&(e=0),{left:i.left,top:e,width:a.width}}return{left:i.left,top:i.top+a.height+1,width:a.width}}if("bottom"==t)return{left:i.left,top:i.top-l.height-1,width:a.width}}.call(this))},c=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&&($.call(this,i.id,{index:{gindex:o.getAttribute("data-option-group-index"),index:o.getAttribute("data-option-index")}},void 0,!0),a.call(this),l.call(this),i.multiple||this.close()),this):(this.close(),this)},u=function(e){var t=this.queue[e],i={};return i.id=t.id,i.theme=t.theme,i.size="ax5combobox-option-group-"+t.size,i.multiple=t.multiple,i.lang=t.lang,i.options=t.options,i.selected=t.selected,i.hasSelected=i.selected&&i.selected.length>0,i.removeIcon=t.removeIcon,o.tmpl.get.call(this,"label",i,t.columnKeys)},d=function(e){var t=this.queue[e];t.$displayLabel.find("[data-ax5combobox-selected-label]").remove(),t.$displayLabelInput.before(u.call(this,e))},p=function(e){return this.queue[e].disabled?this:(this.queue[e].$displayLabel.trigger("focus"),void this.queue[e].$displayLabelInput.focus())},r=function(e){this.queue[e].$displayLabelInput.val("")},h=function(e){this.queue[e].$displayLabel.trigger("blur"),this.queue[e].$displayLabelInput.trigger("blur")},x=function(e,i){this.queue[e].waitOptions=!0,this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(o.tmpl.get.call(this,"option",this.queue[e],this.queue[e].columnKeys))),this.queue[e].onSearch.call({self:this,item:this.queue[e],searchWord:i},function(e){var i={},n=this.queue[this.activecomboboxQueueIndex];return!!n&&(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)})}(n,e),n.options=v.call(this,this.activecomboboxQueueIndex,e.options),a.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,void this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(o.tmpl.get.call(this,"options",i,n.columnKeys))))}.bind(this))},b=function(e,t){if(this.activecomboboxQueueIndex==-1)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){x.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?f.call(this,e,void 0,i[0]["@findex"]):m.call(this,e);try{return i}finally{i=null,n=null,s=null,o=null}},m=function(e){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover").removeAttr("data-option-selected"),this.queue[e].optionFocusIndex=-1},f=function(e,t,o){var i,n,s,a,l=this.queue[e];if(this.activecomboboxOptionGroup&&l.options&&l.options.length>0){if("undefined"!=typeof o?i=o:(n=l.optionFocusIndex==-1?l.optionSelectedIndex||-1:l.optionFocusIndex,n==-1?i=0:(i=n+t,i<0?i=0:i>l.optionItemLength-1&&(i=l.optionItemLength-1))),l.optionFocusIndex=i,l.options[i]&&l.options[i].hide){if("undefined"==typeof t)return this;for(;l.options[i].hide;){if(i+=t,i<0){i=0;break}if(i>l.optionItemLength-1){i=l.optionItemLength-1;break}}}if("undefined"!=typeof i&&(this.activecomboboxOptionGroup.find("[data-option-focus-index]").removeClass("hover"),s=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+i+'"]').addClass("hover"),a=this.activecomboboxOptionGroup.find('[data-els="content"]'),s.get(0))){var c=s.outerHeight(),u=a.innerHeight(),d=a.scrollTop(),p=s.position().top+a.scrollTop();u+d<p+c?a.scrollTop(p+c-u):d>p&&a.scrollTop(p),"undefined"!=typeof t&&l.$displayLabelInput.val(l.options[i].text)}}},v=function(){var e=function(e,t){t?this.queue[e].selected.push(jQuery.extend({},t)):this.queue[e].selected=[]};return function(o,n){var s,a,l,c=this.queue[o],u=0;return e.call(this,o,!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"]=u,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(i,o,t),c.indexedOptions.push({"@gindex":n,"@index":a,"@findex":u,value:t[c.columnKeys.optionValue],text:t[c.columnKeys.optionText]}),u++})):(t["@index"]=n,t["@findex"]=u,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(i,o,t),c.indexedOptions.push({"@index":n,"@findex":u,value:t[c.columnKeys.optionValue],text:t[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=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"]=u,t.selected&&e.call(i,o,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}}(),g=function(e){return e instanceof jQuery?e=e.data("data-ax5combobox-id"):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"))},y=function(e,t,o){return"undefined"==typeof o?!e.multiple||!t:o},S=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,o,n,s){var a=this.queue[e];t.isString(o.index.gindex)?"undefined"!=typeof a.options[o.index.gindex]&&(a.options[o.index.gindex].options[o.index.index][a.columnKeys.optionSelected]=y(a,a.options[o.index.gindex].options[o.index.index][a.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-group-index="'+o.index.gindex+'"][data-option-index="'+o.index.index+'"]').attr("data-option-Selected",a.options[o.index.gindex].options[o.index.index][a.columnKeys.optionSelected].toString())):"undefined"!=typeof a.options[o.index.index]&&(a.options[o.index.index][a.columnKeys.optionSelected]=y(a,a.options[o.index.index][a.columnKeys.optionSelected],n),i.activecomboboxOptionGroup&&i.activecomboboxOptionGroup.find('[data-option-index="'+o.index.index+'"]').attr("data-option-Selected",a.options[o.index.index][a.columnKeys.optionSelected].toString())),"undefined"!=typeof s&&"justSetValue"===s||(v.call(this,e,a.options),l.call(this))},arr:function(o,n,s,a){n.forEach(function(n){if(t.isString(n)||t.isNumber(n))e.text.call(i,o,n,s,"justSetValue");else for(var a in e)if(n[a]){e[a].call(i,o,n,s,"justSetValue");break}}),v.call(this,o,this.queue[o].options),l.call(this)},value:function(e,o,i,n){var s,a=this.queue[e],c=t.search(a.options,function(){return this[a.columnKeys.optionValue]==o[a.columnKeys.optionValue]});c>-1?a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i):(c=a.options.length,s={"@index":c,hide:!0,addedOption:!0},s[a.columnKeys.optionValue]=o,s[a.columnKeys.optionText]=o,a.options.push(s),a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i)),"undefined"!=typeof n&&"justSetValue"===n||(v.call(this,e,this.queue[e].options),l.call(this))},text:function(e,o,i,n){var s,a=this.queue[e],c=t.search(a.options,function(){return this[a.columnKeys.optionText]==o});c>-1?a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i):(c=a.options.length,s={"@index":c,hide:!0,addedOption:!0},s[a.columnKeys.optionValue]=o,s[a.columnKeys.optionText]=o,a.options.push(s),a.options[c][a.columnKeys.optionSelected]=y(a,a.options[c][a.columnKeys.optionSelected],i)),"undefined"!=typeof n&&"justSetValue"===n||(v.call(this,e,this.queue[e].options),l.call(this))},clear:function(e){S.call(this,e),v.call(this,e,this.queue[e].options),m.call(this,e),this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.find("[data-option-index]").attr("data-option-Selected","false"),this.queue[e].optionSelectedIndex=-1}};return function(o,i,n,a){var l=t.isNumber(o)?o:g.call(this,o);if(l===-1)return void console.log(ax5.info.getError("ax5combobox","402","val"));if("undefined"==typeof i)throw"error not found value";if(t.isArray(i))e.clear.call(this,l),e.arr.call(this,l,this.queue[l].multiple||0==i.length?i:[i[i.length-1]],n);else if(t.isString(i)||t.isNumber(i))"undefined"==typeof i||null===i||this.queue[l].multiple||S.call(this,l),e.text.call(this,l,i,n,"justSetValue");else if(null===i)e.clear.call(this,l);else{this.queue[l].multiple||S.call(this,l);for(var c in e)if(i[c]){e[c].call(this,l,i,n,"justSetValue");break}}return v.call(this,l,this.queue[l].options),d.call(this,l),"undefined"!=typeof i&&a&&!a.noStateChange&&s.call(this,this.queue[l],{self:this,item:this.queue[l],state:"changeValue",value:this.queue[l].selected}),o=null,this}}();this.init=function(){this.onStateChanged=e.onStateChanged,this.onChange=e.onChange,jQuery(window).on("resize.ax5combobox-display-"+this.instanceId,function(){a.call(this)}.bind(this))},this.bind=function(n){var s,c=function(){var e=t.debounce(function(e){return this.activecomboboxQueueIndex==-1?this:void b.call(i,e,this.queue[e].$displayLabelInput.val())},150),s=function(e){r.call(this,e)},c={click:function(e,o){var n,s=t.findParentNode(o.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 c=s.getAttribute("data-ax5combobox-remove-index"),u=this.queue[e].selected[c];return $.call(this,e,{index:{gindex:u["@gindex"],index:u["@index"]}},!1,!0),a.call(this),l.call(this),p.call(this,e),t.stopEvent(o),this}"clear"===n&&($.call(this,e,{clear:!0}),a.call(this),l.call(this),p.call(this,e))}else i.activecomboboxQueueIndex==e?this.queue[e].optionFocusIndex==-1&&i.close():(i.open(e),p.call(this,e))},keyUp:function(o,n){if(n.which==ax5.info.eventKeys.ESC&&i.activecomboboxQueueIndex===-1)return t.stopEvent(n),this;i.activecomboboxQueueIndex!=o&&(i.open(o),t.stopEvent(n));var s={40:"KEY_DOWN",38:"KEY_UP"};if(!s[n.which])if(n.which==ax5.info.eventKeys.BACKSPACE&&""==this.queue[o].$displayLabelInput.val()){if(this.queue[o].selected.length>0){var c=this.queue[o].selected[this.queue[o].selected.length-1];$.call(this,o,{index:{gindex:c["@gindex"],index:c["@index"]}},!1,!0)}a.call(this),l.call(this),t.stopEvent(n)}else e.call(this,o)},keyDown:function(e,o){o.which==ax5.info.eventKeys.ESC?(r.call(this,e),this.close(),t.stopEvent(o)):o.which==ax5.info.eventKeys.RETURN?($.call(this,n.id,{index:{gindex:n.indexedOptions[n.optionFocusIndex]["@gindex"],index:n.indexedOptions[n.optionFocusIndex]["@index"]}},void 0,!0),r.call(this,e),a.call(this),this.close(),t.stopEvent(o)):o.which==ax5.info.eventKeys.DOWN?(f.call(this,e,1),t.stopEvent(o)):o.which==ax5.info.eventKeys.UP&&(f.call(this,e,-1),t.stopEvent(o))},focus:function(e,t){},blur:function(e,o){s.call(this,e),t.stopEvent(o)},selectChange:function(e,t){$.call(this,e,{value:this.queue[e].$select.val()},!0)}};return function(e){var t=this.queue[e],i={};return t.selected=[],t.$display?(t.$displayLabel.html(u.call(this,e)),t.options=v.call(this,e,t.options)):(i.instanceId=this.instanceId,i.id=t.id,i.name=t.name,i.theme=t.theme,i.tabIndex=t.tabIndex,i.multiple=t.multiple,i.reset=t.reset,i.label=u.call(this,e),i.formSize=function(){return t.size?"input-"+t.size:""}(),t.$display=jQuery(o.tmpl.get.call(this,"comboboxDisplay",i,t.columnKeys)),t.$displayTable=t.$display.find('[data-els="display-table"]'),t.$displayLabel=t.$display.find('[data-ax5combobox-display="label"]'),t.$displayLabelInput=t.$display.find('[data-ax5combobox-display="input"]'),t.$target.find("select").get(0)?(t.$select=t.$target.find("select"),t.$select.attr("tabindex","-1").attr("class","form-control "+i.formSize),i.name&&t.$select.attr("name","name"),i.multiple&&t.$select.attr("multiple","multiple")):(t.$select=jQuery(o.tmpl.get.call(this,"formSelect",i,t.columnKeys)),t.$target.append(t.$select)),t.$target.append(t.$display),t.options=v.call(this,e,t.options)),a.call(this),t.$display.off("click.ax5combobox").on("click.ax5combobox",c.click.bind(this,e)),t.$displayLabelInput.off("focus.ax5combobox").on("focus.ax5combobox",c.focus.bind(this,e)).off("blur.ax5combobox").on("blur.ax5combobox",c.blur.bind(this,e)).off("keyup.ax5combobox").on("keyup.ax5combobox",c.keyUp.bind(this,e)).off("keydown.ax5combobox").on("keydown.ax5combobox",c.keyDown.bind(this,e)),t.$select.off("change.ax5combobox").on("change.ax5combobox",c.selectChange.bind(this,e)),i=null,t=null,e=null,this}}(),d={};return n=jQuery.extend(!0,d,e,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){t.isObject(e)&&!e.error&&(n=jQuery.extend(!0,n,e))}(t.parseJson(n.$target.attr("data-ax5combobox-config"),!0)),s=t.search(this.queue,function(){return this.id==n.id}),s===-1?(this.queue.push(n),c.call(this,this.queue.length-1)):(this.queue[s]=jQuery.extend(!0,{},this.queue[s],n),c.call(this,s)),d=null,s=null,this):(console.log(ax5.info.getError("ax5combobox","401","bind")),this)},this.open=function(){var i=function(e){e.onExpand.call({self:this,item:e},function(e){if(this.waitOptionsCallback){var i={},n=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)})}(n,e),n.options=v.call(this,this.activecomboboxQueueIndex,e.options),d.call(this,this.activecomboboxQueueIndex),a.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(o.tmpl.get.call(this,"options",i,n.columnKeys)))}}.bind(this))};return function(n,a){this.waitOptionsCallback=null;var u,d,p=t.isNumber(n)?n:g.call(this,n),r=this.queue[p],h={};return r.$display.attr("disabled")?this:(this.openTimer&&clearTimeout(this.openTimer),this.activecomboboxOptionGroup?this.activecomboboxQueueIndex==p?this:a>2?this:(this.close(),this.openTimer=setTimeout(function(){this.open(p,(a||0)+1)}.bind(this),e.animateTime),this):(r.optionFocusIndex=-1,r.selected&&r.selected.length>0&&(r.optionSelectedIndex=r.selected[0]["@findex"]),h.id=r.id,h.theme=r.theme,h.size="ax5combobox-option-group-"+r.size,h.multiple=r.multiple,h.lang=r.lang,r.$display.attr("data-combobox-option-group-opened","true"),r.onExpand&&(h.waitOptions=!0),h.options=t.filter(r.options,function(){return!this.hide}),this.activecomboboxOptionGroup=jQuery(o.tmpl.get.call(this,"optionGroup",h,r.columnKeys)),this.activecomboboxOptionGroup.find('[data-els="content"]').html(jQuery(o.tmpl.get.call(this,"options",h,r.columnKeys))),this.activecomboboxQueueIndex=p,l.call(this,"append"),jQuery(window).on("resize.ax5combobox-"+this.instanceId,function(){l.call(this)}.bind(this)),r.selected&&r.selected.length>0&&(d=this.activecomboboxOptionGroup.find('[data-option-index="'+r.selected[0]["@index"]+'"]'),d.get(0)&&(u=d.position().top-this.activecomboboxOptionGroup.height()/3,this.activecomboboxOptionGroup.find('[data-els="content"]').stop().animate({scrollTop:u},r.animateTime,"swing",function(){}))),jQuery(window).on("click.ax5combobox-"+this.instanceId,function(e){e=e||window.event,c.call(this,e),t.stopEvent(e)}.bind(this)),s.call(this,r,{self:this,state:"open",item:r}),r.onExpand&&(this.waitOptionsCallback=!0,i.call(this,r)),h=null,u=null,d=null,this))}}(),this.update=function(e){return this.bind(e),this},this.setValue=function(e,o,i){var n=t.isNumber(e)?e:g.call(this,e);if(n===-1)return void console.log(ax5.info.getError("ax5combobox","402","val"));if(S.call(this,n),t.isArray(o)){var s=t.map(o,function(){return{value:this}});$.call(this,n,s,i||!0,{noStateChange:!0})}else t.isString(o)||t.isNumber(o)?$.call(this,n,{value:o},i||!0,{noStateChange:!0}):d.call(this,n);return h.call(this,n),a.call(this),this},this.setText=function(e,o,i){var n=t.isNumber(e)?e:g.call(this,e);return n===-1?void console.log(ax5.info.getError("ax5combobox","402","val")):(S.call(this,n),$.call(this,n,o,!0,{noStateChange:!0}),h.call(this,n),a.call(this),this)},this.getSelectedOption=function(e){var o=t.isNumber(e)?e:g.call(this,e);return o===-1?void console.log(ax5.info.getError("ax5combobox","402","val")):t.deepCopy(this.queue[o].selected)},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"),t.$displayLabel.attr("contentEditable","false"),this.activecomboboxOptionGroup.addClass("destroy"),jQuery(window).off("resize.ax5combobox-"+this.instanceId).off("click.ax5combobox-"+this.instanceId).off("keyup.ax5combobox-"+this.instanceId),this.closeTimer=setTimeout(function(){this.activecomboboxOptionGroup&&this.activecomboboxOptionGroup.remove(),this.activecomboboxOptionGroup=null,this.activecomboboxQueueIndex=-1,s.call(this,t,{self:this,state:"close"})}.bind(this),e.animateTime),this.waitOptionsCallback=null,this):this},this.blur=function(e){var o=t.isNumber(e)?e:g.call(this,e);return o===-1?void console.log(ax5.info.getError("ax5combobox","402","val")):(h.call(this,o),this)},this.enable=function(e){var t=g.call(this,e);return"undefined"!=typeof t&&(this.queue[t].disabled=!1,this.queue[t].$display[0]&&(this.queue[t].$display.removeAttr("disabled"),this.queue[t].$displayLabelInput.removeAttr("disabled")),this.queue[t].$select[0]&&this.queue[t].$select.removeAttr("disabled"),s.call(this,this.queue[t],{self:this,state:"enable"})),this},this.disable=function(e){var t=g.call(this,e);return"undefined"!=typeof t&&(this.queue[t].disabled=!0,this.queue[t].$display[0]&&(this.queue[t].$display.attr("disabled","disabled"),this.queue[t].$displayLabelInput.attr("disabled","disabled")),this.queue[t].$select[0]&&this.queue[t].$select.attr("disabled","disabled"),s.call(this,this.queue[t],{self:this,state:"disable"})),this},this.align=function(){return a.call(this),this},this.clear=function(e){var o=t.isNumber(e)?e:g.call(this,e);return o===-1?void console.log(ax5.info.getError("ax5combobox","402","clear")):(S.call(this,o),$.call(this,o,[],!1,{noStateChange:!1}),d.call(this,o),h.call(this,o),a.call(this),this)},this.main=function(){arguments&&t.isObject(arguments[0])?this.setConfig(arguments[0]):this.init()}.apply(this,arguments)}}()),o=ax5.ui.combobox}(),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}}{{/tabIndex}}{{#tabIndex}}tabindex="{{tabIndex}}" {{/tabIndex}}\n data-ax5combobox-display="label"\n spellcheck="false"><input type="text"data-ax5combobox-display="input" style="border:0 none;" /></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</div>\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{{#selected}}\n<option value="{{'+e.optionValue+'}}" selected="true">{{'+e.optionText+"}}</option>\n{{/selected}}\n"},s=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 '},a=function(e){return'{{#selected}}<div tabindex="-1" data-ax5combobox-selected-label="{{@i}}" data-ax5combobox-selected-text="{{text}}"><div data-ax5combobox-remove="true" \ndata-ax5combobox-remove-index="{{@i}}">{{{removeIcon}}}</div><span>{{'+e.optionText+"}}</span></div>{{/selected}}"};e.tmpl={comboboxDisplay:o,formSelect:i,formSelectOptions:n,optionGroup:t,options:s,label:a,get:function(t,o,i){return ax5.mustache.render(e.tmpl[t].call(this,i),o)}}}(),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){if(o)return l;var u;return c.optionFocusIndex>-1&&(u=this.activecomboboxOptionGroup.find('[data-option-focus-index="'+c.optionFocusIndex+'"]')),c.optionFocusIndex>-1&&u.get(0)&&u.attr("data-option-value")?{index:{gindex:u.attr("data-option-group-index"),index:u.attr("data-option-index")}}:c.editable?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){if(o)return 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?i:void 0}}});e.util={nodeTypeProcessor:t}}(),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);case"clear":return ax5.ui.combobox_instance.clear(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}}();
//# sourceMappingURL=ax5combobox.min.js.map
{
"name": "ax5ui-combobox",
"version": "1.4.125",
"version": "1.4.126",
"description": "A combobox plugin that works with Bootstrap & jQuery",

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

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 too big to display

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