| 1 |
define([ |
| 2 |
"dojo/_base/declare", |
| 3 |
"dojo/dom-style", |
| 4 |
"dojo/_base/lang", |
| 5 |
"dojo/query", |
| 6 |
"./popup", |
| 7 |
"./registry", |
| 8 |
"./MenuItem", |
| 9 |
"./hccss" |
| 10 |
], function(declare, domStyle, lang, query, pm, registry, MenuItem){ |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
return declare("dijit.PopupMenuItem", MenuItem, { |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
baseClass: "dijitMenuItem dijitPopupMenuItem", |
| 20 |
|
| 21 |
_fillContent: function(){ |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
if(this.srcNodeRef){ |
| 37 |
var nodes = query("*", this.srcNodeRef); |
| 38 |
this.inherited(arguments, [nodes[0]]); |
| 39 |
|
| 40 |
|
| 41 |
this.dropDownContainer = this.srcNodeRef; |
| 42 |
} |
| 43 |
}, |
| 44 |
|
| 45 |
_openPopup: function( params, focus){ |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
var popup = this.popup; |
| 52 |
|
| 53 |
pm.open(lang.delegate(params, { |
| 54 |
popup: this.popup, |
| 55 |
around: this.domNode |
| 56 |
})); |
| 57 |
|
| 58 |
if(focus && popup.focus){ |
| 59 |
popup.focus(); |
| 60 |
} |
| 61 |
}, |
| 62 |
|
| 63 |
_closePopup: function(){ |
| 64 |
pm.close(this.popup); |
| 65 |
this.popup.parentMenu = null; |
| 66 |
}, |
| 67 |
|
| 68 |
startup: function(){ |
| 69 |
if(this._started){ return; } |
| 70 |
this.inherited(arguments); |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
if(!this.popup){ |
| 75 |
var node = query("[widgetId]", this.dropDownContainer)[0]; |
| 76 |
this.popup = registry.byNode(node); |
| 77 |
} |
| 78 |
this.ownerDocumentBody.appendChild(this.popup.domNode); |
| 79 |
this.popup.domNode.setAttribute("aria-labelledby", this.containerNode.id); |
| 80 |
this.popup.startup(); |
| 81 |
|
| 82 |
this.popup.domNode.style.display="none"; |
| 83 |
if(this.arrowWrapper){ |
| 84 |
domStyle.set(this.arrowWrapper, "visibility", ""); |
| 85 |
} |
| 86 |
this.focusNode.setAttribute("aria-haspopup", "true"); |
| 87 |
}, |
| 88 |
|
| 89 |
destroyDescendants: function( preserveDom){ |
| 90 |
if(this.popup){ |
| 91 |
|
| 92 |
|
| 93 |
if(!this.popup._destroyed){ |
| 94 |
this.popup.destroyRecursive(preserveDom); |
| 95 |
} |
| 96 |
delete this.popup; |
| 97 |
} |
| 98 |
this.inherited(arguments); |
| 99 |
} |
| 100 |
}); |
| 101 |
}); |