You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tt-rss/lib/dijit/_HasDropDown.js

2 lines
5.6 KiB
JavaScript

//>>built
define("dijit/_HasDropDown",["dojo/_base/declare","dojo/_base/Deferred","dojo/_base/event","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/has","dojo/keys","dojo/_base/lang","dojo/on","dojo/window","./registry","./focus","./popup","./_FocusMixin"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,on,_c,_d,_e,_f,_10){return _1("dijit._HasDropDown",_10,{_buttonNode:null,_arrowWrapperNode:null,_popupStateNode:null,_aroundNode:null,dropDown:null,autoWidth:true,forceWidth:false,maxHeight:0,dropDownPosition:["below","above"],_stopClickEvents:true,_onDropDownMouseDown:function(e){if(this.disabled||this.readOnly){return;}e.preventDefault();this._docHandler=this.connect(this.ownerDocument,"mouseup","_onDropDownMouseUp");this.toggleDropDown();},_onDropDownMouseUp:function(e){if(e&&this._docHandler){this.disconnect(this._docHandler);}var _11=this.dropDown,_12=false;if(e&&this._opened){var c=_7.position(this._buttonNode,true);if(!(e.pageX>=c.x&&e.pageX<=c.x+c.w)||!(e.pageY>=c.y&&e.pageY<=c.y+c.h)){var t=e.target;while(t&&!_12){if(_6.contains(t,"dijitPopup")){_12=true;}else{t=t.parentNode;}}if(_12){t=e.target;if(_11.onItemClick){var _13;while(t&&!(_13=_d.byNode(t))){t=t.parentNode;}if(_13&&_13.onClick&&_13.getParent){_13.getParent().onItemClick(_13,e);}}return;}}}if(this._opened){if(_11.focus&&_11.autoFocus!==false){this._focusDropDownTimer=this.defer(function(){_11.focus();delete this._focusDropDownTimer;});}}else{this.defer("focus");}if(_9("touch")){this._justGotMouseUp=true;this.defer(function(){this._justGotMouseUp=false;});}},_onDropDownClick:function(e){if(_9("touch")&&!this._justGotMouseUp){this._onDropDownMouseDown(e);this._onDropDownMouseUp(e);}if(this._stopClickEvents){_3.stop(e);}},buildRendering:function(){this.inherited(arguments);this._buttonNode=this._buttonNode||this.focusNode||this.domNode;this._popupStateNode=this._popupStateNode||this.focusNode||this._buttonNode;var _14={"after":this.isLeftToRight()?"Right":"Left","before":this.isLeftToRight()?"Left":"Right","above":"Up","below":"Down","left":"Left","right":"Right"}[this.dropDownPosition[0]]||this.dropDownPosition[0]||"Down";_6.add(this._arrowWrapperNode||this._buttonNode,"dijit"+_14+"ArrowButton");},postCreate:function(){this.inherited(arguments);var _15=this.focusNode||this.domNode;this.own(on(this._buttonNode,"mousedown",_b.hitch(this,"_onDropDownMouseDown")),on(this._buttonNode,"click",_b.hitch(this,"_onDropDownClick")),on(_15,"keydown",_b.hitch(this,"_onKey")),on(_15,"keyup",_b.hitch(this,"_onKeyUp")));},destroy:function(){if(this.dropDown){if(!this.dropDown._destroyed){this.dropDown.destroyRecursive();}delete this.dropDown;}this.inherited(arguments);},_onKey:function(e){if(this.disabled||this.readOnly){return;}var d=this.dropDown,_16=e.target;if(d&&this._opened&&d.handleKey){if(d.handleKey(e)===false){_3.stop(e);return;}}if(d&&this._opened&&e.keyCode==_a.ESCAPE){this.closeDropDown();_3.stop(e);}else{if(!this._opened&&(e.keyCode==_a.DOWN_ARROW||((e.keyCode==_a.ENTER||e.keyCode==_a.SPACE)&&((_16.tagName||"").toLowerCase()!=="input"||(_16.type&&_16.type.toLowerCase()!=="text"))))){this._toggleOnKeyUp=true;_3.stop(e);}}},_onKeyUp:function(){if(this._toggleOnKeyUp){delete this._toggleOnKeyUp;this.toggleDropDown();var d=this.dropDown;if(d&&d.focus){this.defer(_b.hitch(d,"focus"),1);}}},_onBlur:function(){var _17=_e.curNode&&this.dropDown&&_4.isDescendant(_e.curNode,this.dropDown.domNode);this.closeDropDown(_17);this.inherited(arguments);},isLoaded:function(){return true;},loadDropDown:function(_18){_18();},loadAndOpenDropDown:function(){var d=new _2(),_19=_b.hitch(this,function(){this.openDropDown();d.resolve(this.dropDown);});if(!this.isLoaded()){this.loadDropDown(_19);}else{_19();}return d;},toggleDropDown:function(){if(this.disabled||this.readOnly){return;}if(!this._opened){this.loadAndOpenDropDown();}else{this.closeDropDown();}},openDropDown:function(){var _1a=this.dropDown,_1b=_1a.domNode,_1c=this._aroundNode||this.domNode,_1d=this;if(!this._preparedNode){this._preparedNode=true;if(_1b.style.width){this._explicitDDWidth=true;}if