]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/DropDownButton.js.uncompressed.js
2 'url:dijit/form/templates/DropDownButton.html':"<span class=\"dijit dijitReset dijitInline\"\n\t><span class='dijitReset dijitInline dijitButtonNode'\n\t\tdata-dojo-attach-event=\"ondijitclick:_onClick\" data-dojo-attach-point=\"_buttonNode\"\n\t\t><span class=\"dijitReset dijitStretch dijitButtonContents\"\n\t\t\tdata-dojo-attach-point=\"focusNode,titleNode,_arrowWrapperNode\"\n\t\t\trole=\"button\" aria-haspopup=\"true\" aria-labelledby=\"${id}_label\"\n\t\t\t><span class=\"dijitReset dijitInline dijitIcon\"\n\t\t\t\tdata-dojo-attach-point=\"iconNode\"\n\t\t\t></span\n\t\t\t><span class=\"dijitReset dijitInline dijitButtonText\"\n\t\t\t\tdata-dojo-attach-point=\"containerNode,_popupStateNode\"\n\t\t\t\tid=\"${id}_label\"\n\t\t\t></span\n\t\t\t><span class=\"dijitReset dijitInline dijitArrowButtonInner\"></span\n\t\t\t><span class=\"dijitReset dijitInline dijitArrowButtonChar\">▼</span\n\t\t></span\n\t></span\n\t><input ${!nameAttrSetting} type=\"${type}\" value=\"${value}\" class=\"dijitOffScreen\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-point=\"valueNode\" role=\"presentation\"\n/></span>\n"}});
3 define("dijit/form/DropDownButton", [
4 "dojo/_base/declare", // declare
5 "dojo/_base/lang", // hitch
7 "../registry", // registry.byNode
8 "../popup", // dijit.popup2.hide
12 "dojo/text!./templates/DropDownButton.html"
13 ], function(declare
, lang
, query
, registry
, popup
, Button
, _Container
, _HasDropDown
, template
){
16 // dijit/form/DropDownButton
19 return declare("dijit.form.DropDownButton", [Button
, _Container
, _HasDropDown
], {
21 // A button with a drop down
24 // | <button data-dojo-type="dijit/form/DropDownButton">
26 // | <div data-dojo-type="dijit/Menu">...</div>
30 // | var button1 = new DropDownButton({ label: "hi", dropDown: new dijit.Menu(...) });
31 // | win.body().appendChild(button1);
34 baseClass
: "dijitDropDownButton",
36 templateString
: template
,
38 _fillContent: function(){
39 // Overrides Button._fillContent().
41 // My inner HTML contains both the button contents and a drop down widget, like
42 // <DropDownButton> <span>push me</span> <Menu> ... </Menu> </DropDownButton>
43 // The first node is assumed to be the button content. The widget is the popup.
45 if(this.srcNodeRef
){ // programatically created buttons might not define srcNodeRef
46 //FIXME: figure out how to filter out the widget and use all remaining nodes as button
47 // content, not just nodes[0]
48 var nodes
= query("*", this.srcNodeRef
);
49 this.inherited(arguments
, [nodes
[0]]);
51 // save pointer to srcNode so we can grab the drop down widget after it's instantiated
52 this.dropDownContainer
= this.srcNodeRef
;
57 if(this._started
){ return; }
59 // the child widget from srcNodeRef is the dropdown widget. Insert it in the page DOM,
60 // make it invisible, and store a reference to pass to the popup code.
61 if(!this.dropDown
&& this.dropDownContainer
){
62 var dropDownNode
= query("[widgetId]", this.dropDownContainer
)[0];
63 this.dropDown
= registry
.byNode(dropDownNode
);
64 delete this.dropDownContainer
;
67 popup
.hide(this.dropDown
);
70 this.inherited(arguments
);
74 // Returns whether or not we are loaded - if our dropdown has an href,
75 // then we want to check that.
76 var dropDown
= this.dropDown
;
77 return (!!dropDown
&& (!dropDown
.href
|| dropDown
.isLoaded
));
80 loadDropDown: function(/*Function*/ callback
){
81 // Default implementation assumes that drop down already exists,
82 // but hasn't loaded it's data (ex: ContentPane w/href).
83 // App must override if the drop down is lazy-created.
84 var dropDown
= this.dropDown
;
85 var handler
= dropDown
.on("load", lang
.hitch(this, function(){
89 dropDown
.refresh(); // tell it to load
92 isFocusable: function(){
93 // Overridden so that focus is handled by the _HasDropDown mixin, not by
94 // the _FormWidget mixin.
95 return this.inherited(arguments
) && !this._mouseDown
;