www-thermferm/jqwidgets/jqxdropdownbutton.js

changeset 301
dbaed96a4a0c
parent 117
7119ea8a5225
child 336
217f330b05cb
--- a/www-thermferm/jqwidgets/jqxdropdownbutton.js	Sat Nov 29 16:07:34 2014 +0100
+++ b/www-thermferm/jqwidgets/jqxdropdownbutton.js	Sat Nov 29 21:03:31 2014 +0100
@@ -1,7 +1,7 @@
 /*
-jQWidgets v3.4.0 (2014-June-23)
+jQWidgets v3.6.0 (2014-Nov-25)
 Copyright (c) 2011-2014 jQWidgets.
 License: http://jqwidgets.com/license/
 */
 
-(function(a){a.jqx.jqxWidget("jqxDropDownButton","",{});a.extend(a.jqx._jqxDropDownButton.prototype,{defineInstance:function(){this.disabled=false;this.width=null;this.height=null;this.arrowSize=19;this.enableHover=true;if(this.openDelay==undefined){this.openDelay=250}if(this.closeDelay==undefined){this.closeDelay=300}this.animationType="default";this.enableBrowserBoundsDetection=false;this.dropDownHorizontalAlignment="left";this.popupZIndex=20000;this.autoOpen=false;this.rtl=false;this.initContent=null;this.dropDownWidth=null;this.dropDownHeight=null;this.focusable=true;this.touchMode=false;this.aria={"aria-disabled":{name:"disabled",type:"boolean"}};this.events=["open","close","opening","closing"]},createInstance:function(i){if(!this.width){this.width=200}if(!this.height){this.height=25}this.isanimating=false;var c=a("<div style='background-color: transparent; -webkit-appearance: none; outline: none; width:100%; height: 100%; padding: 0px; margin: 0px; border: 0px; position: relative;'><div id='dropDownButtonWrapper' style='outline: none; background-color: transparent; border: none; float: left; width:100%; height: 100%; position: relative;'><div id='dropDownButtonContent' unselectable='on' style='outline: none; background-color: transparent; border: none; float: left; position: relative;'/><div id='dropDownButtonArrow' unselectable='on'  style='background-color: transparent; border: none; float: right; position: relative;'><div unselectable='on'></div></div></div></div>");if(this.host.attr("tabindex")){c.attr("tabindex",this.host.attr("tabindex"));this.host.removeAttr("tabindex")}else{c.attr("tabindex",0)}if(!this.focusable){c.removeAttr("tabIndex")}a.jqx.aria(this);this.popupContent=this.host.children();this.host.attr("role","button");if(this.popupContent.length==0){this.popupContent=a("<div>"+this.host.text()+"</div>");this.popupContent.css("display","block");this.element.innerHTML=""}else{this.popupContent.detach()}var j=this;this.addHandler(this.host,"loadContent",function(e){j._arrange()});try{var f="dropDownButtonPopup"+this.element.id;var d=a(a.find("#"+f));if(d.length>0){d.remove()}a.jqx.aria(this,"aria-haspopup",true);a.jqx.aria(this,"aria-owns",f);var b=a("<div class='dropDownButton' style='overflow: hidden; left: 0px; top: 0px; position: absolute;' id='dropDownButtonPopup"+this.element.id+"'></div>");b.addClass(this.toThemeProperty("jqx-widget-content"));b.addClass(this.toThemeProperty("jqx-dropdownbutton-popup"));b.addClass(this.toThemeProperty("jqx-popup"));b.addClass(this.toThemeProperty("jqx-rc-all"));b.css("z-index",this.popupZIndex);if(a.jqx.browser.msie){b.addClass(this.toThemeProperty("jqx-noshadow"))}this.popupContent.appendTo(b);b.appendTo(document.body);this.container=b;this.container.css("visibility","hidden")}catch(g){}this.touch=a.jqx.mobile.isTouchDevice();this.dropDownButtonStructure=c;this.host.append(c);this.dropDownButtonWrapper=this.host.find("#dropDownButtonWrapper");this.firstDiv=this.dropDownButtonWrapper.parent();this.dropDownButtonArrow=this.host.find("#dropDownButtonArrow");this.arrow=a(this.dropDownButtonArrow.children()[0]);this.dropDownButtonContent=this.host.find("#dropDownButtonContent");this.dropDownButtonContent.addClass(this.toThemeProperty("jqx-dropdownlist-content"));this.dropDownButtonWrapper.addClass(this.toThemeProperty("jqx-disableselect"));if(this.rtl){this.dropDownButtonContent.addClass(this.toThemeProperty("jqx-rtl"))}var l=this;if(this.host.parents()){this.addHandler(this.host.parents(),"scroll.dropdownbutton"+this.element.id,function(e){var m=l.isOpened();if(m){l.close()}})}this.addHandler(this.dropDownButtonWrapper,"selectstart",function(){return false});this.dropDownButtonWrapper[0].id="dropDownButtonWrapper"+this.element.id;this.dropDownButtonArrow[0].id="dropDownButtonArrow"+this.element.id;this.dropDownButtonContent[0].id="dropDownButtonContent"+this.element.id;var l=this;this.propertyChangeMap.disabled=function(e,n,m,o){if(o){e.host.addClass(l.toThemeProperty("jqx-dropdownlist-state-disabled"));e.host.addClass(l.toThemeProperty("jqx-fill-state-disabled"));e.dropDownButtonContent.addClass(l.toThemeProperty("jqx-dropdownlist-content-disabled"))}else{e.host.removeClass(l.toThemeProperty("jqx-dropdownlist-state-disabled"));e.host.removeClass(l.toThemeProperty("jqx-fill-state-disabled"));e.dropDownButtonContent.removeClass(l.toThemeProperty("jqx-dropdownlist-content-disabled"))}a.jqx.aria(e,"aria-disabled",e.disabled)};if(this.disabled){this.host.addClass(this.toThemeProperty("jqx-dropdownlist-state-disabled"));this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this.dropDownButtonContent.addClass(this.toThemeProperty("jqx-dropdownlist-content-disabled"))}var h=this.toThemeProperty("jqx-rc-all")+" "+this.toThemeProperty("jqx-fill-state-normal")+" "+this.toThemeProperty("jqx-widget")+" "+this.toThemeProperty("jqx-widget-content")+" "+this.toThemeProperty("jqx-dropdownlist-state-normal");this.host.addClass(h);this.arrow.addClass(this.toThemeProperty("jqx-icon-arrow-down"));this.arrow.addClass(this.toThemeProperty("jqx-icon"));this._setSize();this.render();if(a.jqx.browser.msie&&a.jqx.browser.version<8){this.container.css("display","none");if(this.host.parents(".jqx-window").length>0){var k=this.host.parents(".jqx-window").css("z-index");b.css("z-index",k+10);this.container.css("z-index",k+10)}}},setContent:function(b){this.dropDownButtonContent.children().remove();this.dropDownButtonContent[0].innerHTML="";this.dropDownButtonContent.append(b)},val:function(b){if(arguments.length==0||typeof(b)=="object"){return this.dropDownButtonContent.text()}else{this.dropDownButtonContent.html(b)}},getContent:function(){if(this.dropDownButtonContent.children().length>0){return this.dropDownButtonContent.children()}return this.dropDownButtonContent.text()},_setSize:function(){if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host[0].style.width=this.width}else{if(this.width!=undefined&&!isNaN(this.width)){this.host[0].style.width=parseInt(this.width)+"px"}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host[0].style.height=this.height}else{if(this.height!=undefined&&!isNaN(this.height)){this.host[0].style.height=parseInt(this.height)+"px"}}var c=false;if(this.width!=null&&this.width.toString().indexOf("%")!=-1){c=true;this.host.width(this.width)}if(this.height!=null&&this.height.toString().indexOf("%")!=-1){c=true;this.host.height(this.height)}var b=this;if(c){this.refresh(false)}a.jqx.utilities.resize(this.host,function(){b._arrange()})},isOpened:function(){var c=this;var b=a.data(document.body,"openedJQXButton"+this.element.id);if(b!=null&&b==c.popupContent){return true}return false},focus:function(){try{this.host.focus()}catch(b){}},render:function(){this.removeHandlers();var b=this;var c=false;if(!this.touch){this.addHandler(this.host,"mouseenter",function(){if(!b.disabled&&b.enableHover){c=true;b.host.addClass(b.toThemeProperty("jqx-dropdownlist-state-hover"));b.arrow.addClass(b.toThemeProperty("jqx-icon-arrow-down-hover"));b.host.addClass(b.toThemeProperty("jqx-fill-state-hover"))}});this.addHandler(this.host,"mouseleave",function(){if(!b.disabled&&b.enableHover){b.host.removeClass(b.toThemeProperty("jqx-dropdownlist-state-hover"));b.host.removeClass(b.toThemeProperty("jqx-fill-state-hover"));b.arrow.removeClass(b.toThemeProperty("jqx-icon-arrow-down-hover"));c=false}})}if(b.autoOpen){this.addHandler(this.host,"mouseenter",function(){var d=b.isOpened();if(!d&&b.autoOpen){b.open();b.host.focus()}});this.addHandler(a(document),"mousemove."+b.element.id,function(g){var f=b.isOpened();if(f&&b.autoOpen){var k=b.host.coord();var j=k.top;var i=k.left;var h=b.container.coord();var d=h.left;var e=h.top;canClose=true;if(g.pageY>=j&&g.pageY<=j+b.host.height()){if(g.pageX>=i&&g.pageX<i+b.host.width()){canClose=false}}if(g.pageY>=e&&g.pageY<=e+b.container.height()){if(g.pageX>=d&&g.pageX<d+b.container.width()){canClose=false}}if(canClose){b.close()}}})}this.addHandler(this.dropDownButtonWrapper,"mousedown",function(e){if(!b.disabled){var d=b.container.css("visibility")=="visible";if(!b.isanimating){if(d){b.close();return false}else{b.open();if(!b.focusable){if(e.preventDefault){e.preventDefault()}}}}}});if(this.touch){this.addHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+"."+this.element.id,b.closeOpenedDropDown,{me:this,popup:this.container,id:this.element.id})}this.addHandler(a(document),"mousedown."+this.element.id,b.closeOpenedDropDown,{me:this,popup:this.container,id:this.element.id});this.addHandler(this.host,"keydown",function(e){var d=b.container.css("visibility")=="visible";if(b.host.css("display")=="none"){return true}if(e.keyCode=="13"){if(!b.isanimating){if(d){b.close()}}}if(e.keyCode==115){if(!b.isanimating){if(!b.isOpened()){b.open()}else{if(b.isOpened()){b.close()}}}return false}if(e.altKey){if(b.host.css("display")=="block"){if(e.keyCode==38){if(b.isOpened()){b.close()}}else{if(e.keyCode==40){if(!b.isOpened()){b.open()}}}}}if(e.keyCode=="27"){if(!b.ishiding){b.close();if(b.tempSelectedIndex!=undefined){b.selectIndex(b.tempSelectedIndex)}}}});this.addHandler(this.firstDiv,"focus",function(){b.host.addClass(b.toThemeProperty("jqx-dropdownlist-state-focus"));b.host.addClass(b.toThemeProperty("jqx-fill-state-focus"))});this.addHandler(this.firstDiv,"blur",function(){b.host.removeClass(b.toThemeProperty("jqx-dropdownlist-state-focus"));b.host.removeClass(b.toThemeProperty("jqx-fill-state-focus"))})},removeHandlers:function(){var b=this;this.removeHandler(this.dropDownButtonWrapper,"mousedown");this.removeHandler(this.host,"keydown");this.removeHandler(this.firstDiv,"focus");this.removeHandler(this.firstDiv,"blur");this.removeHandler(this.host,"mouseenter");this.removeHandler(this.host,"mouseleave");if(this.autoOpen){this.removeHandler(this.host,"mouseenter");this.removeHandler(this.host,"mouseleave")}this.removeHandler(a(document),"mousemove."+b.element.id)},_findPos:function(c){while(c&&(c.type=="hidden"||c.nodeType!=1||a.expr.filters.hidden(c))){c=c.nextSibling}var b=a(c).coord(true);return[b.left,b.top]},testOffset:function(h,f,c){var g=h.outerWidth();var j=h.outerHeight();var i=a(window).width()+a(window).scrollLeft();var e=a(window).height()+a(window).scrollTop();if(f.left+g>i){if(g>this.host.width()){var d=this.host.coord().left;var b=g-this.host.width();f.left=d-b+2}}if(f.left<0){f.left=parseInt(this.host.coord().left)+"px"}if(f.top+j>e){f.top-=Math.abs(j+c)}return f},_getBodyOffset:function(){var c=0;var b=0;if(a("body").css("border-top-width")!="0px"){c=parseInt(a("body").css("border-top-width"));if(isNaN(c)){c=0}}if(a("body").css("border-left-width")!="0px"){b=parseInt(a("body").css("border-left-width"));if(isNaN(b)){b=0}}return{left:b,top:c}},open:function(){a.jqx.aria(this,"aria-expanded",true);var p=this;if((this.dropDownWidth==null||this.dropDownWidth=="auto")&&this.width!=null&&this.width.indexOf&&this.width.indexOf("%")!=-1){var c=this.host.width();this.container.width(parseInt(c))}p._raiseEvent("2");var b=this.popupContent;var m=a(window).scrollTop();var i=a(window).scrollLeft();var l=parseInt(this._findPos(this.host[0])[1])+parseInt(this.host.outerHeight())-1+"px";var f,h=parseInt(Math.round(this.host.coord(true).left));f=h+"px";var o=a.jqx.mobile.isSafariMobileBrowser()||a.jqx.mobile.isWindowsPhone();var d=a.jqx.utilities.hasTransform(this.host);this.ishiding=false;this.tempSelectedIndex=this.selectedIndex;if(d||(o!=null&&o)){f=a.jqx.mobile.getLeftPos(this.element);l=a.jqx.mobile.getTopPos(this.element)+parseInt(this.host.outerHeight());if(a("body").css("border-top-width")!="0px"){l=parseInt(l)-this._getBodyOffset().top+"px"}if(a("body").css("border-left-width")!="0px"){f=parseInt(f)-this._getBodyOffset().left+"px"}}b.stop();this.host.addClass(this.toThemeProperty("jqx-dropdownlist-state-selected"));this.host.addClass(this.toThemeProperty("jqx-fill-state-pressed"));this.arrow.addClass(this.toThemeProperty("jqx-icon-arrow-down-selected"));var g=false;if(a.jqx.browser.msie&&a.jqx.browser.version<8){g=true}if(g){this.container.css("display","block")}this.container.css("left",f);this.container.css("top",l);var e=true;var q=false;var k=function(){if(this.dropDownHorizontalAlignment=="right"||this.rtl){var s=this.container.width();var r=Math.abs(s-this.host.width());if(s>this.host.width()){this.container.css("left",parseInt(Math.round(h))-r+"px")}else{this.container.css("left",parseInt(Math.round(h))+r+"px")}}};k.call(this);if(this.enableBrowserBoundsDetection){var j=this.testOffset(b,{left:parseInt(this.container.css("left")),top:parseInt(l)},parseInt(this.host.outerHeight()));if(parseInt(this.container.css("top"))!=j.top){q=true;this.container.height(b.outerHeight());b.css("top",23);if(this.interval){clearInterval(this.interval)}this.interval=setInterval(function(){if(b.outerHeight()!=p.container.height()){var r=p.testOffset(b,{left:parseInt(p.container.css("left")),top:parseInt(l)},parseInt(p.host.outerHeight()));p.container.css("top",r.top);p.container.height(b.outerHeight())}},50)}else{b.css("top",0)}this.container.css("top",j.top);if(parseInt(this.container.css("left"))!=j.left){this.container.css("left",j.left)}}if(this.animationType=="none"){this.container.css("visibility","visible");a.data(document.body,"openedJQXButtonParent",p);a.data(document.body,"openedJQXButton"+this.element.id,b);b.css("margin-top",0);b.css("opacity",1);this._raiseEvent("0");k.call(p)}else{this.container.css("visibility","visible");var n=b.outerHeight();p.isanimating=true;if(this.animationType=="fade"){b.css("margin-top",0);b.css("opacity",0);b.animate({opacity:1},this.openDelay,function(){a.data(document.body,"openedJQXButtonParent",p);a.data(document.body,"openedJQXButton"+p.element.id,b);p.ishiding=false;p.isanimating=false;p._raiseEvent("0")});k.call(p)}else{b.css("opacity",1);if(q){b.css("margin-top",n)}else{b.css("margin-top",-n)}k.call(p);b.animate({"margin-top":0},this.openDelay,function(){a.data(document.body,"openedJQXButtonParent",p);a.data(document.body,"openedJQXButton"+p.element.id,b);p.ishiding=false;p.isanimating=false;p._raiseEvent("0")})}}if(!q){this.host.addClass(this.toThemeProperty("jqx-rc-b-expanded"));this.container.addClass(this.toThemeProperty("jqx-rc-t-expanded"))}else{this.host.addClass(this.toThemeProperty("jqx-rc-t-expanded"));this.container.addClass(this.toThemeProperty("jqx-rc-b-expanded"))}if(this.focusable){this.firstDiv.focus();setTimeout(function(){p.firstDiv.focus()},10)}this.container.addClass(this.toThemeProperty("jqx-fill-state-focus"));this.host.addClass(p.toThemeProperty("jqx-dropdownlist-state-focus"));this.host.addClass(p.toThemeProperty("jqx-fill-state-focus"))},close:function(){a.jqx.aria(this,"aria-expanded",false);var e=this.popupContent;var d=this.container;var f=this;f._raiseEvent("3");var c=false;if(a.jqx.browser.msie&&a.jqx.browser.version<8){c=true}if(!this.isOpened()){return}a.data(document.body,"openedJQXButton"+this.element.id,null);if(this.animationType=="none"){this.container.css("visibility","hidden");if(c){this.container.css("display","none")}}else{if(!f.ishiding){f.isanimating=true;e.stop();var b=e.outerHeight();e.css("margin-top",0);var g=-b;if(parseInt(this.container.coord().top)<parseInt(this.host.coord().top)){g=b}if(this.animationType=="fade"){e.css({opacity:1});e.animate({opacity:0},this.closeDelay,function(){d.css("visibility","hidden");f.isanimating=false;f.ishiding=false;if(c){d.css("display","none")}})}else{e.animate({"margin-top":g},this.closeDelay,function(){d.css("visibility","hidden");f.isanimating=false;f.ishiding=false;if(c){d.css("display","none")}})}}}this.ishiding=true;this.host.removeClass(this.toThemeProperty("jqx-dropdownlist-state-selected"));this.host.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));this.arrow.removeClass(this.toThemeProperty("jqx-icon-arrow-down-selected"));this.host.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));this.container.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));this.host.removeClass(this.toThemeProperty("jqx-rc-t-expanded"));this.container.removeClass(this.toThemeProperty("jqx-rc-b-expanded"));this.container.removeClass(this.toThemeProperty("jqx-fill-state-focus"));this.host.removeClass(this.toThemeProperty("jqx-dropdownlist-state-focus"));this.host.removeClass(this.toThemeProperty("jqx-fill-state-focus"));this._raiseEvent("1")},closeOpenedDropDown:function(e){var c=e.data.me;var b=a(e.target);if(a(e.target).ischildof(e.data.me.host)){return true}if(a(e.target).ischildof(e.data.me.popupContent)){return true}var f=c;var d=false;a.each(b.parents(),function(){if(this.className!="undefined"){if(this.className.indexOf&&this.className.indexOf("dropDownButton")!=-1){d=true;return false}}});if(!d){c.close()}return true},refresh:function(){this._arrange()},_arrange:function(){var f=parseInt(this.host.width());var b=parseInt(this.host.height());var e=this.arrowSize;var d=this.arrowSize;var g=3;var c=f-d-2*g;if(c>0){this.dropDownButtonContent[0].style.width=c+"px"}this.dropDownButtonContent[0].style.height=parseInt(b)+"px";this.dropDownButtonContent[0].style.left="0px";this.dropDownButtonContent[0].style.top="0px";this.dropDownButtonArrow[0].style.width=parseInt(d)+"px";this.dropDownButtonArrow[0].style.height=parseInt(b)+"px";if(this.rtl){this.dropDownButtonArrow.css("float","left");this.dropDownButtonContent.css("float","right");this.dropDownButtonContent.css("left",-g)}if(this.dropDownWidth!=null){if(this.dropDownWidth.toString().indexOf("%")>=0){var f=(parseInt(this.dropDownWidth)*this.host.width())/100;this.container.width(f)}else{this.container.width(this.dropDownWidth)}}if(this.dropDownHeight!=null){this.container.height(this.dropDownHeight)}},destroy:function(){this.removeHandler(this.dropDownButtonWrapper,"selectstart");this.removeHandler(this.dropDownButtonWrapper,"mousedown");this.removeHandler(this.host,"keydown");this.host.removeClass();this.removeHandler(a(document),"mousedown."+this.element.id,self.closeOpenedDropDown);this.host.remove();this.container.remove()},_raiseEvent:function(f,c){if(c==undefined){c={owner:null}}if(f==2&&!this.contentInitialized){if(this.initContent){this.initContent();this.contentInitialized=true}}var d=this.events[f];args=c;args.owner=this;var e=new jQuery.Event(d);e.owner=this;if(f==2||f==3||f==4){e.args=c}var b=this.host.trigger(e);return b},resize:function(c,b){this.width=c;this.height=b;this._setSize();this._arrange()},propertyChangedHandler:function(b,c,e,d){if(this.isInitialized==undefined||this.isInitialized==false){return}if(c=="rtl"){if(d){b.dropDownButtonArrow.css("float","left");b.dropDownButtonContent.css("float","right")}else{b.dropDownButtonArrow.css("float","right");b.dropDownButtonContent.css("float","left")}}if(c=="autoOpen"){b.render()}if(c=="theme"&&d!=null){a.jqx.utilities.setTheme(e,d,b.host)}if(c=="width"||c=="height"){b._setSize();b._arrange()}}})})(jQuery);
\ No newline at end of file
+(function(a){a.jqx.jqxWidget("jqxDropDownButton","",{});a.extend(a.jqx._jqxDropDownButton.prototype,{defineInstance:function(){var b={disabled:false,width:null,height:null,arrowSize:19,enableHover:true,openDelay:250,closeDelay:300,animationType:"default",enableBrowserBoundsDetection:false,dropDownHorizontalAlignment:"left",popupZIndex:20000,autoOpen:false,rtl:false,initContent:null,dropDownWidth:null,dropDownHeight:null,focusable:true,touchMode:false,aria:{"aria-disabled":{name:"disabled",type:"boolean"}},events:["open","close","opening","closing"]};a.extend(true,this,b);return b},createInstance:function(j){var g=this;if(!g.width){g.width=200}if(!g.height){g.height=25}g.isanimating=false;g.setupInstance();var c=a("<div style='background-color: transparent; -webkit-appearance: none; outline: none; width:100%; height: 100%; padding: 0px; margin: 0px; border: 0px; position: relative;'><div id='dropDownButtonWrapper' style='outline: none; background-color: transparent; border: none; float: left; width:100%; height: 100%; position: relative;'><div id='dropDownButtonContent' unselectable='on' style='outline: none; background-color: transparent; border: none; float: left; position: relative;'/><div id='dropDownButtonArrow' unselectable='on'  style='background-color: transparent; border: none; float: right; position: relative;'><div unselectable='on'></div></div></div></div>");if(g.host.attr("tabindex")){c.attr("tabindex",g.host.attr("tabindex"));g.host.removeAttr("tabindex")}else{c.attr("tabindex",0)}if(!g.focusable){c.removeAttr("tabIndex")}a.jqx.aria(this);g.popupContent=g.host.children();g.host.attr("role","button");if(g.popupContent.length==0){g.popupContent=a("<div>"+g.host.text()+"</div>");g.popupContent.css("display","block");g.element.innerHTML=""}else{g.popupContent.detach()}var k=this;g.addHandler(g.host,"loadContent",function(e){k._arrange()});try{var f="dropDownButtonPopup"+g.element.id;var d=a(a.find("#"+f));if(d.length>0){d.remove()}a.jqx.aria(this,"aria-haspopup",true);a.jqx.aria(this,"aria-owns",f);var b=a("<div class='dropDownButton' style='overflow: hidden; left: 0px; top: 0px; position: absolute;' id='dropDownButtonPopup"+g.element.id+"'></div>");b.addClass(g.toThemeProperty("jqx-widget-content"));b.addClass(g.toThemeProperty("jqx-dropdownbutton-popup"));b.addClass(g.toThemeProperty("jqx-popup"));b.addClass(g.toThemeProperty("jqx-rc-all"));b.css("z-index",g.popupZIndex);if(a.jqx.browser.msie){b.addClass(g.toThemeProperty("jqx-noshadow"))}g.popupContent.appendTo(b);b.appendTo(document.body);g.container=b;g.container.css("visibility","hidden")}catch(h){}g.touch=a.jqx.mobile.isTouchDevice();g.dropDownButtonStructure=c;g.host.append(c);g.dropDownButtonWrapper=g.host.find("#dropDownButtonWrapper");g.firstDiv=g.dropDownButtonWrapper.parent();g.dropDownButtonArrow=g.host.find("#dropDownButtonArrow");g.arrow=a(g.dropDownButtonArrow.children()[0]);g.dropDownButtonContent=g.host.find("#dropDownButtonContent");g.dropDownButtonContent.addClass(g.toThemeProperty("jqx-dropdownlist-content"));g.dropDownButtonWrapper.addClass(g.toThemeProperty("jqx-disableselect"));if(g.rtl){g.dropDownButtonContent.addClass(g.toThemeProperty("jqx-rtl"))}var m=this;if(g.host.parents()){g.addHandler(g.host.parents(),"scroll.dropdownbutton"+g.element.id,function(e){var n=m.isOpened();if(n){m.close()}})}g.addHandler(g.dropDownButtonWrapper,"selectstart",function(){return false});g.dropDownButtonWrapper[0].id="dropDownButtonWrapper"+g.element.id;g.dropDownButtonArrow[0].id="dropDownButtonArrow"+g.element.id;g.dropDownButtonContent[0].id="dropDownButtonContent"+g.element.id;var m=this;g.propertyChangeMap.disabled=function(e,o,n,p){if(p){e.host.addClass(m.toThemeProperty("jqx-dropdownlist-state-disabled"));e.host.addClass(m.toThemeProperty("jqx-fill-state-disabled"));e.dropDownButtonContent.addClass(m.toThemeProperty("jqx-dropdownlist-content-disabled"))}else{e.host.removeClass(m.toThemeProperty("jqx-dropdownlist-state-disabled"));e.host.removeClass(m.toThemeProperty("jqx-fill-state-disabled"));e.dropDownButtonContent.removeClass(m.toThemeProperty("jqx-dropdownlist-content-disabled"))}a.jqx.aria(e,"aria-disabled",e.disabled)};if(g.disabled){g.host.addClass(g.toThemeProperty("jqx-dropdownlist-state-disabled"));g.host.addClass(g.toThemeProperty("jqx-fill-state-disabled"));g.dropDownButtonContent.addClass(g.toThemeProperty("jqx-dropdownlist-content-disabled"))}var i=g.toThemeProperty("jqx-rc-all")+" "+g.toThemeProperty("jqx-fill-state-normal")+" "+g.toThemeProperty("jqx-widget")+" "+g.toThemeProperty("jqx-widget-content")+" "+g.toThemeProperty("jqx-dropdownlist-state-normal");g.host.addClass(i);g.arrow.addClass(g.toThemeProperty("jqx-icon-arrow-down"));g.arrow.addClass(g.toThemeProperty("jqx-icon"));g._setSize();g.render();if(a.jqx.browser.msie&&a.jqx.browser.version<8){g.container.css("display","none");if(g.host.parents(".jqx-window").length>0){var l=g.host.parents(".jqx-window").css("z-index");b.css("z-index",l+10);g.container.css("z-index",l+10)}}},setupInstance:function(){var c=this;var b={setContent:function(d){c.dropDownButtonContent.children().remove();c.dropDownButtonContent[0].innerHTML="";c.dropDownButtonContent.append(d)},val:function(d){if(arguments.length==0||typeof(d)=="object"){return c.dropDownButtonContent.text()}else{c.dropDownButtonContent.html(d)}},getContent:function(){if(c.dropDownButtonContent.children().length>0){return c.dropDownButtonContent.children()}return c.dropDownButtonContent.text()},_setSize:function(){if(c.width!=null&&c.width.toString().indexOf("px")!=-1){c.host[0].style.width=c.width}else{if(c.width!=undefined&&!isNaN(c.width)){c.host[0].style.width=parseInt(c.width)+"px"}}if(c.height!=null&&c.height.toString().indexOf("px")!=-1){c.host[0].style.height=c.height}else{if(c.height!=undefined&&!isNaN(c.height)){c.host[0].style.height=parseInt(c.height)+"px"}}var e=false;if(c.width!=null&&c.width.toString().indexOf("%")!=-1){e=true;c.host.width(c.width)}if(c.height!=null&&c.height.toString().indexOf("%")!=-1){e=true;c.host.height(c.height)}var d=this;if(e){c.refresh(false)}a.jqx.utilities.resize(c.host,function(){d._arrange()})},isOpened:function(){var e=this;var d=a.data(document.body,"openedJQXButton"+e.element.id);if(d!=null&&d==e.popupContent){return true}return false},focus:function(){try{c.host.focus()}catch(d){}},render:function(){c.removeHandlers();var d=this;var e=false;if(!c.touch){c.addHandler(c.host,"mouseenter",function(){if(!d.disabled&&d.enableHover){e=true;d.host.addClass(d.toThemeProperty("jqx-dropdownlist-state-hover"));d.arrow.addClass(d.toThemeProperty("jqx-icon-arrow-down-hover"));d.host.addClass(d.toThemeProperty("jqx-fill-state-hover"))}});c.addHandler(c.host,"mouseleave",function(){if(!d.disabled&&d.enableHover){d.host.removeClass(d.toThemeProperty("jqx-dropdownlist-state-hover"));d.host.removeClass(d.toThemeProperty("jqx-fill-state-hover"));d.arrow.removeClass(d.toThemeProperty("jqx-icon-arrow-down-hover"));e=false}})}if(d.autoOpen){c.addHandler(c.host,"mouseenter",function(){var f=d.isOpened();if(!f&&d.autoOpen){d.open();d.host.focus()}});c.addHandler(a(document),"mousemove."+d.element.id,function(i){var h=d.isOpened();if(h&&d.autoOpen){var m=d.host.coord();var l=m.top;var k=m.left;var j=d.container.coord();var f=j.left;var g=j.top;canClose=true;if(i.pageY>=l&&i.pageY<=l+d.host.height()){if(i.pageX>=k&&i.pageX<k+d.host.width()){canClose=false}}if(i.pageY>=g&&i.pageY<=g+d.container.height()){if(i.pageX>=f&&i.pageX<f+d.container.width()){canClose=false}}if(canClose){d.close()}}})}c.addHandler(c.dropDownButtonWrapper,"mousedown",function(g){if(!d.disabled){var f=d.container.css("visibility")=="visible";if(!d.isanimating){if(f){d.close();return false}else{d.open();if(!d.focusable){if(g.preventDefault){g.preventDefault()}}}}}});if(c.touch){c.addHandler(a(document),a.jqx.mobile.getTouchEventName("touchstart")+"."+c.element.id,d.closeOpenedDropDown,{me:this,popup:c.container,id:c.element.id})}c.addHandler(a(document),"mousedown."+c.element.id,d.closeOpenedDropDown,{me:this,popup:c.container,id:c.element.id});c.addHandler(c.host,"keydown",function(g){var f=d.container.css("visibility")=="visible";if(d.host.css("display")=="none"){return true}if(g.keyCode=="13"){if(!d.isanimating){if(f){d.close()}}}if(g.keyCode==115){if(!d.isanimating){if(!d.isOpened()){d.open()}else{if(d.isOpened()){d.close()}}}return false}if(g.altKey){if(d.host.css("display")=="block"){if(g.keyCode==38){if(d.isOpened()){d.close()}}else{if(g.keyCode==40){if(!d.isOpened()){d.open()}}}}}if(g.keyCode=="27"){if(!d.ishiding){d.close();if(d.tempSelectedIndex!=undefined){d.selectIndex(d.tempSelectedIndex)}}}});c.addHandler(c.firstDiv,"focus",function(){d.host.addClass(d.toThemeProperty("jqx-dropdownlist-state-focus"));d.host.addClass(d.toThemeProperty("jqx-fill-state-focus"))});c.addHandler(c.firstDiv,"blur",function(){d.host.removeClass(d.toThemeProperty("jqx-dropdownlist-state-focus"));d.host.removeClass(d.toThemeProperty("jqx-fill-state-focus"))})},removeHandlers:function(){var d=this;c.removeHandler(c.dropDownButtonWrapper,"mousedown");c.removeHandler(c.host,"keydown");c.removeHandler(c.firstDiv,"focus");c.removeHandler(c.firstDiv,"blur");c.removeHandler(c.host,"mouseenter");c.removeHandler(c.host,"mouseleave");if(c.autoOpen){c.removeHandler(c.host,"mouseenter");c.removeHandler(c.host,"mouseleave")}c.removeHandler(a(document),"mousemove."+d.element.id)},_findPos:function(e){while(e&&(e.type=="hidden"||e.nodeType!=1||a.expr.filters.hidden(e))){e=e.nextSibling}var d=a(e).coord(true);return[d.left,d.top]},testOffset:function(j,h,e){var i=j.outerWidth();var l=j.outerHeight();var k=a(window).width()+a(window).scrollLeft();var g=a(window).height()+a(window).scrollTop();if(h.left+i>k){if(i>c.host.width()){var f=c.host.coord().left;var d=i-c.host.width();h.left=f-d+2}}if(h.left<0){h.left=parseInt(c.host.coord().left)+"px"}if(h.top+l>g){h.top-=Math.abs(l+e)}return h},_getBodyOffset:function(){var e=0;var d=0;if(a("body").css("border-top-width")!="0px"){e=parseInt(a("body").css("border-top-width"));if(isNaN(e)){e=0}}if(a("body").css("border-left-width")!="0px"){d=parseInt(a("body").css("border-left-width"));if(isNaN(d)){d=0}}return{left:d,top:e}},open:function(){a.jqx.aria(this,"aria-expanded",true);var m=this;var s=this;if((m.dropDownWidth==null||m.dropDownWidth=="auto")&&m.width!=null&&m.width.indexOf&&m.width.indexOf("%")!=-1){var e=m.host.width();m.container.width(parseInt(e))}s._raiseEvent("2");var d=m.popupContent;var p=a(window).scrollTop();var k=a(window).scrollLeft();var o=parseInt(m._findPos(m.host[0])[1])+parseInt(m.host.outerHeight())-1+"px";var h,j=parseInt(Math.round(m.host.coord(true).left));h=j+"px";var r=a.jqx.mobile.isSafariMobileBrowser()||a.jqx.mobile.isWindowsPhone();var f=a.jqx.utilities.hasTransform(m.host);m.ishiding=false;m.tempSelectedIndex=m.selectedIndex;if(f||(r!=null&&r)){h=a.jqx.mobile.getLeftPos(m.element);o=a.jqx.mobile.getTopPos(m.element)+parseInt(m.host.outerHeight());if(a("body").css("border-top-width")!="0px"){o=parseInt(o)-m._getBodyOffset().top+"px"}if(a("body").css("border-left-width")!="0px"){h=parseInt(h)-m._getBodyOffset().left+"px"}}d.stop();m.host.addClass(m.toThemeProperty("jqx-dropdownlist-state-selected"));m.host.addClass(m.toThemeProperty("jqx-fill-state-pressed"));m.arrow.addClass(m.toThemeProperty("jqx-icon-arrow-down-selected"));var i=false;if(a.jqx.browser.msie&&a.jqx.browser.version<8){i=true}if(i){m.container.css("display","block")}m.container.css("left",h);m.container.css("top",o);var g=true;var t=false;var n=function(){if(m.dropDownHorizontalAlignment=="right"||m.rtl){var v=m.container.width();var u=Math.abs(v-m.host.width());if(v>m.host.width()){m.container.css("left",parseInt(Math.round(j))-u+"px")}else{m.container.css("left",parseInt(Math.round(j))+u+"px")}}};n.call(this);if(m.enableBrowserBoundsDetection){var l=m.testOffset(d,{left:parseInt(m.container.css("left")),top:parseInt(o)},parseInt(m.host.outerHeight()));if(parseInt(m.container.css("top"))!=l.top){t=true;m.container.height(d.outerHeight());d.css("top",23);if(m.interval){clearInterval(m.interval)}m.interval=setInterval(function(){if(d.outerHeight()!=s.container.height()){var u=s.testOffset(d,{left:parseInt(s.container.css("left")),top:parseInt(o)},parseInt(s.host.outerHeight()));s.container.css("top",u.top);s.container.height(d.outerHeight())}},50)}else{d.css("top",0)}m.container.css("top",l.top);if(parseInt(m.container.css("left"))!=l.left){m.container.css("left",l.left)}}if(m.animationType=="none"){m.container.css("visibility","visible");a.data(document.body,"openedJQXButtonParent",s);a.data(document.body,"openedJQXButton"+m.element.id,d);d.css("margin-top",0);d.css("opacity",1);m._raiseEvent("0");n.call(s)}else{m.container.css("visibility","visible");var q=d.outerHeight();s.isanimating=true;if(m.animationType=="fade"){d.css("margin-top",0);d.css("opacity",0);d.animate({opacity:1},m.openDelay,function(){a.data(document.body,"openedJQXButtonParent",s);a.data(document.body,"openedJQXButton"+s.element.id,d);s.ishiding=false;s.isanimating=false;s._raiseEvent("0")});n.call(s)}else{d.css("opacity",1);if(t){d.css("margin-top",q)}else{d.css("margin-top",-q)}n.call(s);d.animate({"margin-top":0},m.openDelay,function(){a.data(document.body,"openedJQXButtonParent",s);a.data(document.body,"openedJQXButton"+s.element.id,d);s.ishiding=false;s.isanimating=false;s._raiseEvent("0")})}}if(!t){m.host.addClass(m.toThemeProperty("jqx-rc-b-expanded"));m.container.addClass(m.toThemeProperty("jqx-rc-t-expanded"))}else{m.host.addClass(m.toThemeProperty("jqx-rc-t-expanded"));m.container.addClass(m.toThemeProperty("jqx-rc-b-expanded"))}if(m.focusable){m.firstDiv.focus();setTimeout(function(){s.firstDiv.focus()},10)}m.container.addClass(m.toThemeProperty("jqx-fill-state-focus"));m.host.addClass(s.toThemeProperty("jqx-dropdownlist-state-focus"));m.host.addClass(s.toThemeProperty("jqx-fill-state-focus"))},close:function(){a.jqx.aria(this,"aria-expanded",false);var i=this;var g=i.popupContent;var f=i.container;var h=this;h._raiseEvent("3");var e=false;if(a.jqx.browser.msie&&a.jqx.browser.version<8){e=true}if(!i.isOpened()){return}a.data(document.body,"openedJQXButton"+i.element.id,null);if(i.animationType=="none"){i.container.css("visibility","hidden");if(e){i.container.css("display","none")}}else{if(!h.ishiding){h.isanimating=true;g.stop();var d=g.outerHeight();g.css("margin-top",0);var j=-d;if(parseInt(i.container.coord().top)<parseInt(i.host.coord().top)){j=d}if(i.animationType=="fade"){g.css({opacity:1});g.animate({opacity:0},i.closeDelay,function(){f.css("visibility","hidden");h.isanimating=false;h.ishiding=false;if(e){f.css("display","none")}})}else{g.animate({"margin-top":j},i.closeDelay,function(){f.css("visibility","hidden");h.isanimating=false;h.ishiding=false;if(e){f.css("display","none")}})}}}i.ishiding=true;i.host.removeClass(i.toThemeProperty("jqx-dropdownlist-state-selected"));i.host.removeClass(i.toThemeProperty("jqx-fill-state-pressed"));i.arrow.removeClass(i.toThemeProperty("jqx-icon-arrow-down-selected"));i.host.removeClass(i.toThemeProperty("jqx-rc-b-expanded"));i.container.removeClass(i.toThemeProperty("jqx-rc-t-expanded"));i.host.removeClass(i.toThemeProperty("jqx-rc-t-expanded"));i.container.removeClass(i.toThemeProperty("jqx-rc-b-expanded"));i.container.removeClass(i.toThemeProperty("jqx-fill-state-focus"));i.host.removeClass(i.toThemeProperty("jqx-dropdownlist-state-focus"));i.host.removeClass(i.toThemeProperty("jqx-fill-state-focus"));i._raiseEvent("1")},closeOpenedDropDown:function(g){var e=g.data.me;var d=a(g.target);if(a(g.target).ischildof(g.data.me.host)){return true}if(a(g.target).ischildof(g.data.me.popupContent)){return true}var h=e;var f=false;a.each(d.parents(),function(){if(this.className!="undefined"){if(this.className.indexOf&&this.className.indexOf("dropDownButton")!=-1){f=true;return false}}});if(!f){e.close()}return true},refresh:function(){c._arrange()},_arrange:function(){var i=this;var h=parseInt(i.host.width());var d=parseInt(i.host.height());var g=i.arrowSize;var f=i.arrowSize;var j=3;var e=h-f-2*j;if(e>0){i.dropDownButtonContent[0].style.width=e+"px"}i.dropDownButtonContent[0].style.height=parseInt(d)+"px";i.dropDownButtonContent[0].style.left="0px";i.dropDownButtonContent[0].style.top="0px";i.dropDownButtonArrow[0].style.width=parseInt(f)+"px";i.dropDownButtonArrow[0].style.height=parseInt(d)+"px";if(i.rtl){i.dropDownButtonArrow.css("float","left");i.dropDownButtonContent.css("float","right");i.dropDownButtonContent.css("left",-j)}if(i.dropDownWidth!=null){if(i.dropDownWidth.toString().indexOf("%")>=0){var h=(parseInt(i.dropDownWidth)*i.host.width())/100;i.container.width(h)}else{i.container.width(i.dropDownWidth)}}if(i.dropDownHeight!=null){i.container.height(i.dropDownHeight)}},destroy:function(){var d=this;d.removeHandler(d.dropDownButtonWrapper,"selectstart");d.removeHandler(d.dropDownButtonWrapper,"mousedown");d.removeHandler(d.host,"keydown");d.host.removeClass();d.removeHandler(a(document),"mousedown."+d.element.id,self.closeOpenedDropDown);d.host.remove();d.container.remove()},_raiseEvent:function(h,e){if(e==undefined){e={owner:null}}if(h==2&&!c.contentInitialized){if(c.initContent){c.initContent();c.contentInitialized=true}}var f=c.events[h];args=e;args.owner=this;var g=new a.Event(f);g.owner=this;if(h==2||h==3||h==4){g.args=e}var d=c.host.trigger(g);return d},resize:function(e,d){c.width=e;c.height=d;c._setSize();c._arrange()},propertyChangedHandler:function(d,e,g,f){if(c.isInitialized==undefined||c.isInitialized==false){return}if(e=="rtl"){if(f){d.dropDownButtonArrow.css("float","left");d.dropDownButtonContent.css("float","right")}else{d.dropDownButtonArrow.css("float","right");d.dropDownButtonContent.css("float","left")}}if(e=="autoOpen"){d.render()}if(e=="theme"&&f!=null){a.jqx.utilities.setTheme(g,f,d.host)}if(e=="width"||e=="height"){d._setSize();d._arrange()}}};a.extend(true,this,b)}})})(jqxBaseFramework);
\ No newline at end of file

mercurial