2013-03-18 06:26:24 +00:00
|
|
|
define("dijit/form/_AutoCompleterMixin",["dojo/data/util/filter","dojo/_base/declare","dojo/dom-attr","dojo/_base/event","dojo/keys","dojo/_base/lang","dojo/query","dojo/regexp","dojo/sniff","dojo/string","./DataList","../registry","./_TextBoxMixin","./_SearchMixin"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e){return _2("dijit.form._AutoCompleterMixin",_e,{item:null,autoComplete:true,highlightMatch:"first",labelAttr:"",labelType:"text",maxHeight:-1,_stopClickEvents:false,_getCaretPos:function(_f){var pos=0;if(typeof (_f.selectionStart)=="number"){pos=_f.selectionStart;}else{if(_9("ie")){var tr=_f.ownerDocument.selection.createRange().duplicate();var ntr=_f.createTextRange();tr.move("character",0);ntr.move("character",0);try{ntr.setEndPoint("EndToEnd",tr);pos=String(ntr.text).replace(/\r/g,"").length;}catch(e){}}}return pos;},_setCaretPos:function(_10,_11){_11=parseInt(_11);_d.selectInputText(_10,_11,_11);},_setDisabledAttr:function(_12){this.inherited(arguments);this.domNode.setAttribute("aria-disabled",_12?"true":"false");},_onKey:function(evt){if(evt.charCode>=32){return;}var key=evt.charCode||evt.keyCode;if(key==_5.ALT||key==_5.CTRL||key==_5.META||key==_5.SHIFT){return;}var pw=this.dropDown;var _13=null;this._abortQuery();this.inherited(arguments);if(evt.altKey||evt.ctrlKey||evt.metaKey){return;}if(this._opened){_13=pw.getHighlightedOption();}switch(key){case _5.PAGE_DOWN:case _5.DOWN_ARROW:case _5.PAGE_UP:case _5.UP_ARROW:if(this._opened){this._announceOption(_13);}_4.stop(evt);break;case _5.ENTER:if(_13){if(_13==pw.nextButton){this._nextSearch(1);_4.stop(evt);break;}else{if(_13==pw.previousButton){this._nextSearch(-1);_4.stop(evt);break;}}_4.stop(evt);}else{this._setBlurValue();this._setCaretPos(this.focusNode,this.focusNode.value.length);}case _5.TAB:var _14=this.get("displayedValue");if(pw&&(_14==pw._messages["previousMessage"]||_14==pw._messages["nextMessage"])){break;}if(_13){this._selectOption(_13);}case _5.ESCAPE:if(this._opened){this._lastQuery=null;this.closeDropDown();}break;}},_autoCompleteText:function(_15){var fn=this.focusNode;_d.selectInputText(fn,fn.value.length);var _16=this.ignoreCase?"toLowerCase":"substr";if(_15[_16](0).indexOf(this.focusNode.value[_16](0))==0){var _17=this.autoComplete?this._getCaretPos(fn):fn.value.length;if((_17+1)>fn.value.length){fn.value=_15;_d.selectInputText(fn,_17);}}else{fn.value=_15;_d.selectInputText(fn);}},_openResultList:function(_18,_19,_1a){var _1b=this.dropDown.getHighlightedOption();this.dropDown.clearResultList();if(!_18.length&&_1a.start==0){this.closeDropDown();return;}this._nextSearch=this.dropDown.onPage=_6.hitch(this,function(_1c){_18.nextPage(_1c!==-1);this.focus();});this.dropDown.createOptions(_18,_1a,_6.hitch(this,"_getMenuLabelFromItem"));this._showResultList();if("direction" in _1a){if(_1a.direction){this.dropDown.highlightFirstOption();}else{if(!_1a.direction){this.dropDown.highlightLastOption();}}if(_1b){this._announceOption(this.dropDown.getHighlightedOption());}}else{if(this.autoComplete&&!this._prev_key_backspace&&!/^[*]+$/.test(_19[this.searchAttr].toString())){this._announceOption(this.dropDown.containerNode.firstChild.nextSibling);}}},_showResultList:function(){this.closeDropDown(true);this.openDropDown();this.domNode.setAttribute("aria-expanded","true");},loadDropDown:function(){this._startSearchAll();},isLoaded:function(){return false;},closeDropDown:function(){this._abortQuery();if(this._opened){this.inherited(arguments);this.domNode.setAttribute("aria-expanded","false");this.focusNode.removeAttribute("aria-activedescendant");}},_setBlurValue:function(){var _1d=this.get("displayedValue");var pw=this.dropDown;if(pw&&(_1d==pw._messages["previousMessage"]||_1d==pw._messages["nextMessage"])){this._setValueAttr(this._lastValueReported,true);}else{if(typeof this.item=="undefined"){this.item=null;this.set("displayedValue",_1d);}else{if(this.value!=this._lastValueReported){this._handleOnChange(this.value,true);}this._refreshState();}}},_setItemAttr:function(_1e,_1f,_20){var _21="";if(_1e){if(!_20){_20=this.store._oldAPI?this.store.getValue
|