www-thermferm/jqwidgets/jqxresponsivepanel.js

Sun, 07 Jul 2019 14:31:10 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 07 Jul 2019 14:31:10 +0200
branch
stable
changeset 603
fcff55324b84
parent 511
2d1d43c3a2c2
child 617
b216f9d4b917
permissions
-rw-r--r--

Merged fix from default

/*
jQWidgets v4.5.2 (2017-May)
Copyright (c) 2011-2017 jQWidgets.
License: http://jqwidgets.com/license/
*/
!function(a){a.jqx.jqxWidget("jqxResponsivePanel","",{}),a.extend(a.jqx._jqxResponsivePanel.prototype,{defineInstance:function(){var b={width:null,height:null,collapseBreakpoint:1e3,collapseWidth:null,toggleButton:null,toggleButtonSize:30,animationType:"fade",animationDirection:"left",animationShowDelay:"fast",animationHideDelay:"fast",autoClose:!0,initContent:null,_collapsed:!1,_opened:!1,_init:!1,_ie7:a.jqx.browser.msie&&a.jqx.browser.version<8,events:["collapse","expand","open","close"]};return this===a.jqx._jqxResponsivePanel.prototype?b:(a.extend(!0,this,b),b)},createInstance:function(){var a=this;a.initContent&&a._init===!1&&(a.initContent(),a._init=!0),a._render(!0)},_render:function(b){var c=this;if(b===!0&&c.toggleButton){if(c._toggleButton=a(c.toggleButton),0===c._toggleButton.length)throw new Error('jqxResponsivePanel: Invalid toggleButton selector: "'+c.toggleButton+'".');var d=a('<div class="'+c.toThemeProperty("jqx-menu-minimized-button")+" "+c.toThemeProperty("jqx-responsive-panel-button-inner")+'"></div>');c._toggleButton.append(d)}c._setSize(),c._addClasses(),b===!1&&c._removeHandlers(),c._addHandlers(),c._checkWindowSize()},render:function(){this._render(!1)},refresh:function(a){a!==!0&&this._checkWindowSize()},destroy:function(a){var b=this;b._removeHandlers(),b.host.remove(),a!==!0&&b.toggleButton&&b._toggleButton.remove()},propertyChangedHandler:function(a,b,c,d){if(d!==c&&"toggleButton"!==b&&"initContent"!==b)switch(b){case"width":case"height":a.host.css(b,d);break;case"collapseBreakpoint":a._checkWindowSize();break;case"toggleButtonSize":a.toggleButton&&a._toggleButton.css({width:d,height:d});break;default:a.render()}},open:function(){function a(){b.host.show(),b._opened=!0,b._raiseEvent("2"),b.initContent&&b._init===!1&&(b.initContent(),b._init=!0)}var b=this;if(b._collapsed===!0&&b._opened===!1){if(b._ie7===!0)return void a();switch(b.animationType){case"fade":b.host.fadeIn(b.animationShowDelay,function(){b._raiseEvent("2"),b._opened=!0,b.initContent&&b._init===!1&&(b.initContent(),b._init=!0)});break;case"slide":var c=b.animationDirection;"top"===c?c="up":"bottom"===c&&(c="down"),b._slide(b.host,{mode:"show",direction:c,duration:b.animationShowDelay});break;case"none":a()}}},close:function(){var a=this;if(a._collapsed===!0&&a._opened===!0){if(a._ie7===!0)return a.host.hide(),a._opened=!1,void a._raiseEvent("3");switch(a.animationType){case"fade":a.host.fadeOut(a.animationHideDelay,function(){a._opened=!1,a._raiseEvent("3")});break;case"slide":var b=a.animationDirection;"top"===b?b="up":"bottom"===b&&(b="down"),a._slide(a.host,{mode:"hide",direction:b,duration:a.animationHideDelay});break;case"none":a.host.hide(),a._opened=!1,a._raiseEvent("3")}}},_raiseEvent:function(b,c){void 0===c&&(c={owner:null});var d=this.events[b];c.owner=this;var e=new a.Event(d);e.owner=this,e.args=c,e.preventDefault&&e.preventDefault();var f=this.host.trigger(e);return f},_setSize:function(){var a=this;a.host.css("width",a.width),a.host.css("height",a.height),a.toggleButton&&a._toggleButton.css({width:a.toggleButtonSize,height:a.toggleButtonSize})},_addClasses:function(){var a=this;a.host.addClass(a.toThemeProperty("jqx-responsive-panel")),a.host.addClass(a.toThemeProperty("jqx-widget")),a.host.addClass(a.toThemeProperty("jqx-widget-content")),a.host.addClass(a.toThemeProperty("jqx-rc-all")),a.toggleButton&&(a._toggleButton.addClass(a.toThemeProperty("jqx-responsive-panel-button")),a._toggleButton.addClass(a.toThemeProperty("jqx-fill-state-normal")),a._toggleButton.addClass(a.toThemeProperty("jqx-rc-all")))},isCollapsed:function(){return this._collapsed},isOpened:function(){return this._opened},_addHandlers:function(){var b=this,c=b.element.id;b.addHandler(b.host,"click.jqxResponsivePanel"+c,function(a){a.stopPropagation()}),b.addHandler(a(document),"click.jqxResponsivePanel"+c,function(){b._collapsed===!0&&b.autoClose===!0&&b.close()}),b.addHandler(a(window),"resize.jqxResponsivePanel"+c,function(){setTimeout(function(){b._checkWindowSize()},0)}),b.toggleButton&&(b.addHandler(b._toggleButton,"mouseenter.jqxResponsivePanel"+c,function(){b._toggleButton.addClass(b.toThemeProperty("jqx-fill-state-hover"))}),b.addHandler(b._toggleButton,"mouseleave.jqxResponsivePanel"+c,function(){b._toggleButton.removeClass(b.toThemeProperty("jqx-fill-state-hover"))}),b.addHandler(b._toggleButton,"mousedown.jqxResponsivePanel"+c,function(){b._toggleButton.addClass(b.toThemeProperty("jqx-fill-state-pressed"))}),b.addHandler(a(document),"mouseup.jqxResponsivePanel"+c,function(){b._toggleButton.removeClass(b.toThemeProperty("jqx-fill-state-pressed"))}),b.addHandler(b._toggleButton,"click.jqxResponsivePanel"+c,function(a){a.stopPropagation(),b._opened===!0?b.close():b.open()}))},_removeHandlers:function(){var b=this,c=b.element.id;b.removeHandler(b.host,"click.jqxResponsivePanel"+c),b.removeHandler(a(document),"click.jqxResponsivePanel"+c),b.removeHandler(a(window),"resize.jqxResponsivePanel"+c),b.toggleButton&&(b.removeHandler(b._toggleButton,"mouseenter.jqxResponsivePanel"+c),b.removeHandler(b._toggleButton,"mouseleave.jqxResponsivePanel"+c),b.removeHandler(b._toggleButton,"mousedown.jqxResponsivePanel"+c),b.removeHandler(a(document),"mouseup.jqxResponsivePanel"+c),b.removeHandler(b._toggleButton,"click.jqxResponsivePanel"+c))},_checkWindowSize:function(){var a=this,b=this.host.parent().width();a._collapsed===!1&&b<=a.collapseBreakpoint?(a.toggleButton&&a._toggleButton.show(),a._opened===!1&&a.host.hide(),a.host.removeClass(a.toThemeProperty("jqx-responsive-panel-expanded")),a.host.addClass(a.toThemeProperty("jqx-responsive-panel-collapsed")),a._collapsed=!0,a._raiseEvent("0"),a.collapseWidth&&a.host.width(a.collapseWidth),a.host.trigger("resize")):a._collapsed===!0&&b>a.collapseBreakpoint&&(a.collapseWidth&&a.host.width(a.width),a.toggleButton&&a._toggleButton.hide(),a._opened===!1&&a.host.show(),a.host.removeClass(a.toThemeProperty("jqx-responsive-panel-collapsed")),a.host.addClass(a.toThemeProperty("jqx-responsive-panel-expanded")),a._collapsed=!1,a._raiseEvent("1"),a.initContent&&a._init===!1&&(a.initContent(),a._init=!0),a.host.trigger("resize"))},_slide:function(b,c){var d=this;if(d.activeAnimations||(d.activeAnimations=[]),d.activeAnimations.length>0)for(var e=0;e<d.activeAnimations.length;e++)d.activeAnimations[e].clearQueue(),d.activeAnimations[e].finish();else b.clearQueue(),b.finish();var f,g="ui-effects-",h={save:function(a,b){for(var c=0;c<b.length;c++)null!==b[c]&&a.length>0&&a.data(g+b[c],a[0].style[b[c]])},restore:function(a,b){var c,d;for(d=0;d<b.length;d++)null!==b[d]&&(c=a.data(g+b[d]),void 0===c&&(c=""),a.css(b[d],c))},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),float:b.css("float")},d=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:b.width(),height:b.height()},f=document.activeElement;try{f.id}catch(a){f=document.body}return b.wrap(d),(b[0]===f||a.contains(b[0],f))&&a(f).focus(),d=b.parent(),"static"===b.css("position")?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),b.css(e),d.css(c).show()},removeWrapper:function(b){var c=document.activeElement;return b.parent().is(".ui-effects-wrapper")&&(b.parent().replaceWith(b),(b[0]===c||a.contains(b[0],c))&&a(c).focus()),b}},i=["position","top","bottom","left","right","width","height"],j=c.mode,k="show"===j,l=c.direction||"left",m="up"===l||"down"===l?"top":"left",n="up"===l||"left"===l,o={};h.save(b,i),b.show(),f=c.distance||b["top"===m?"outerHeight":"outerWidth"](!0),h.createWrapper(b).css({overflow:"hidden"}),k&&b.css(m,n?isNaN(f)?"-"+f:-f:f),o[m]=(k?n?"+=":"-=":n?"-=":"+=")+f;var p=function(){b.clearQueue(),b.stop(!0,!0)};return d.activeAnimations.push(b),b.animate(o,{duration:c.duration,easing:c.easing,complete:function(){d.activeAnimations.pop(b),"show"===j?(d._opened=!0,d._raiseEvent("2"),d.initContent&&d._init===!1&&(d.initContent(),d._init=!0)):"hide"===j&&(b.hide(),d._opened=!1,d._raiseEvent("3")),h.restore(b,i),h.removeWrapper(b)}}),p}})}(jqxBaseFramework);

mercurial