tt-rss/lib/dijit/layout/StackController.js

2 lines
5.6 KiB
JavaScript
Raw Normal View History

2012-08-14 16:59:10 +02:00
//>>built
define("dijit/layout/StackController",["dojo/_base/array","dojo/_base/declare","dojo/dom-class","dojo/dom-construct","dojo/keys","dojo/_base/lang","dojo/on","dojo/topic","../focus","../registry","../_Widget","../_TemplatedMixin","../_Container","../form/ToggleButton","dojo/touch"],function(_1,_2,_3,_4,_5,_6,on,_7,_8,_9,_a,_b,_c,_d){var _e=_2("dijit.layout._StackButton",_d,{tabIndex:"-1",closeButton:false,_aria_attr:"aria-selected",buildRendering:function(_f){this.inherited(arguments);(this.focusNode||this.domNode).setAttribute("role","tab");}});var _10=_2("dijit.layout.StackController",[_a,_b,_c],{baseClass:"dijitStackController",templateString:"<span role='tablist' data-dojo-attach-event='onkeydown'></span>",containerId:"",buttonWidget:_e,buttonWidgetCloseClass:"dijitStackCloseButton",pane2button:function(id){return _9.byId(this.id+"_"+id);},postCreate:function(){this.inherited(arguments);this.own(_7.subscribe(this.containerId+"-startup",_6.hitch(this,"onStartup")),_7.subscribe(this.containerId+"-addChild",_6.hitch(this,"onAddChild")),_7.subscribe(this.containerId+"-removeChild",_6.hitch(this,"onRemoveChild")),_7.subscribe(this.containerId+"-selectChild",_6.hitch(this,"onSelectChild")),_7.subscribe(this.containerId+"-containerKeyDown",_6.hitch(this,"onContainerKeyDown")));this.containerNode.dojoClick=true;this.own(on(this.containerNode,"click",_6.hitch(this,function(evt){var _11=_9.getEnclosingWidget(evt.target);if(_11!=this.containerNode&&!_11.disabled&&_11.page){for(var _12=evt.target;_12!==this.containerNode;_12=_12.parentNode){if(_3.contains(_12,this.buttonWidgetCloseClass)){this.onCloseButtonClick(_11.page);break;}else{if(_12==_11.domNode){this.onButtonClick(_11.page);break;}}}}})));},onStartup:function(_13){this.textDir=_13.textDir;_1.forEach(_13.children,this.onAddChild,this);if(_13.selected){this.onSelectChild(_13.selected);}var _14=_9.byId(this.containerId).containerNode,_15=_6.hitch(this,"pane2button"),_16={"title":"label","showtitle":"showLabel","iconclass":"iconClass","closable":"closeButton","tooltip":"title","disabled":"disabled","textdir":"textdir"},_17=function(_18,_19){return on(_14,"attrmodified-"+_18,function(evt){var _1a=_15(evt.detail&&evt.detail.widget&&evt.detail.widget.id);if(_1a){_1a.set(_19,evt.detail.newValue);}});};for(var _1b in _16){this.own(_17(_1b,_16[_1b]));}},destroy:function(_1c){this.destroyDescendants(_1c);this.inherited(arguments);},onAddChild:function(_1d,_1e){var Cls=_6.isString(this.buttonWidget)?_6.getObject(this.buttonWidget):this.buttonWidget;var _1f=new Cls({id:this.id+"_"+_1d.id,name:this.id+"_"+_1d.id,label:_1d.title,disabled:_1d.disabled,ownerDocument:this.ownerDocument,dir:_1d.dir,lang:_1d.lang,textDir:_1d.textDir||this.textDir,showLabel:_1d.showTitle,iconClass:_1d.iconClass,closeButton:_1d.closable,title:_1d.tooltip,page:_1d});this.addChild(_1f,_1e);_1d.controlButton=_1f;if(!this._currentChild){this.onSelectChild(_1d);}var _20=_1d._wrapper.getAttribute("aria-labelledby")?_1d._wrapper.getAttribute("aria-labelledby")+" "+_1f.id:_1f.id;_1d._wrapper.removeAttribute("aria-label");_1d._wrapper.setAttribute("aria-labelledby",_20);},onRemoveChild:function(_21){if(this._currentChild===_21){this._currentChild=null;}var _22=this.pane2button(_21.id);if(_22){this.removeChild(_22);_22.destroy();}delete _21.controlButton;},onSelectChild:function(_23){if(!_23){return;}if(this._currentChild){var _24=this.pane2button(this._currentChild.id);_24.set("checked",false);_24.focusNode.setAttribute("tabIndex","-1");}var _25=this.pane2button(_23.id);_25.set("checked",true);this._currentChild=_23;_25.focusNode.setAttribute("tabIndex","0");var _26=_9.byId(this.containerId);},onButtonClick:function(_27){var _28=this.pane2button(_27.id);_8.focus(_28.focusNode);if(this._currentChild&&this._currentChild.id===_27.id){_28.set("checked",true);}var _29=_9.byId(this.containerId);_29.selectChild(_27);},onCloseButtonClick:function(_2a){var _2b=_9.byId(this.containerId);_2b.closeChild(_2a);if(this._currentChild){var b=this.pane2button(this._currentChild.id);if(b){_8.focus(b.focusNode||b.domNode);}}},adjacent:f