123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- define("dijit/form/_ComboBoxMenu", [
- "dojo/_base/declare",
- "dojo/dom-class",
- "dojo/dom-construct",
- "dojo/dom-style",
- "dojo/keys",
- "../_WidgetBase",
- "../_TemplatedMixin",
- "./_ComboBoxMenuMixin",
- "./_ListMouseMixin"
- ], function(declare, domClass, domConstruct, domStyle, keys,
- _WidgetBase, _TemplatedMixin, _ComboBoxMenuMixin, _ListMouseMixin){
-
-
-
-
- return declare("dijit.form._ComboBoxMenu",[_WidgetBase, _TemplatedMixin, _ListMouseMixin, _ComboBoxMenuMixin], {
-
-
-
-
-
-
-
- templateString: "<div class='dijitReset dijitMenu' data-dojo-attach-point='containerNode' style='overflow: auto; overflow-x: hidden;'>"
- +"<div class='dijitMenuItem dijitMenuPreviousButton' data-dojo-attach-point='previousButton' role='option'></div>"
- +"<div class='dijitMenuItem dijitMenuNextButton' data-dojo-attach-point='nextButton' role='option'></div>"
- +"</div>",
- baseClass: "dijitComboBoxMenu",
- postCreate: function(){
- this.inherited(arguments);
- if(!this.isLeftToRight()){
- domClass.add(this.previousButton, "dijitMenuItemRtl");
- domClass.add(this.nextButton, "dijitMenuItemRtl");
- }
- },
- _createMenuItem: function(){
- return domConstruct.create("div", {
- "class": "dijitReset dijitMenuItem" +(this.isLeftToRight() ? "" : " dijitMenuItemRtl"),
- role: "option"
- });
- },
- onHover: function(/*DomNode*/ node){
-
-
- domClass.add(node, "dijitMenuItemHover");
- },
- onUnhover: function(/*DomNode*/ node){
-
-
- domClass.remove(node, "dijitMenuItemHover");
- },
- onSelect: function(/*DomNode*/ node){
-
-
- domClass.add(node, "dijitMenuItemSelected");
- },
- onDeselect: function(/*DomNode*/ node){
-
-
- domClass.remove(node, "dijitMenuItemSelected");
- },
- _page: function(/*Boolean*/ up){
-
-
- var scrollamount = 0;
- var oldscroll = this.domNode.scrollTop;
- var height = domStyle.get(this.domNode, "height");
-
- if(!this.getHighlightedOption()){
- this.selectNextNode();
- }
- while(scrollamount<height){
- var highlighted_option = this.getHighlightedOption();
- if(up){
-
- if(!highlighted_option.previousSibling ||
- highlighted_option.previousSibling.style.display == "none"){
- break;
- }
- this.selectPreviousNode();
- }else{
-
- if(!highlighted_option.nextSibling ||
- highlighted_option.nextSibling.style.display == "none"){
- break;
- }
- this.selectNextNode();
- }
-
- var newscroll = this.domNode.scrollTop;
- scrollamount += (newscroll-oldscroll)*(up ? -1:1);
- oldscroll = newscroll;
- }
- },
- handleKey: function(evt){
-
-
-
- switch(evt.keyCode){
- case keys.DOWN_ARROW:
- this.selectNextNode();
- return false;
- case keys.PAGE_DOWN:
- this._page(false);
- return false;
- case keys.UP_ARROW:
- this.selectPreviousNode();
- return false;
- case keys.PAGE_UP:
- this._page(true);
- return false;
- default:
- return true;
- }
- }
- });
- });
|