| 1 |
define([ |
| 2 |
"dojo/_base/declare", |
| 3 |
"dojo/dom-construct", |
| 4 |
"dijit/_WidgetBase", |
| 5 |
"dijit/form/_FormValueMixin", |
| 6 |
"dijit/form/_TextBoxMixin", |
| 7 |
"dojo/has", |
| 8 |
"dojo/has!dojo-bidi?dojox/mobile/bidi/TextBox" |
| 9 |
], function(declare, domConstruct, WidgetBase, FormValueMixin, TextBoxMixin, has, BidiTextBox){ |
| 10 |
|
| 11 |
var TextBox = declare(has("dojo-bidi") ? "dojox.mobile.NonBidiTextBox" : "dojox.mobile.TextBox", [WidgetBase, FormValueMixin, TextBoxMixin],{ |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
baseClass: "mblTextBox", |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
_setTypeAttr: null, |
| 20 |
|
| 21 |
|
| 22 |
_setPlaceHolderAttr: function(value){ |
| 23 |
value = this._cv ? this._cv(value) : value; |
| 24 |
this._set("placeHolder", value); |
| 25 |
this.textbox.setAttribute("placeholder", value); |
| 26 |
}, |
| 27 |
|
| 28 |
buildRendering: function(){ |
| 29 |
if(!this.srcNodeRef){ |
| 30 |
this.srcNodeRef = domConstruct.create("input", {"type":this.type}); |
| 31 |
} |
| 32 |
this.inherited(arguments); |
| 33 |
this.textbox = this.focusNode = this.domNode; |
| 34 |
}, |
| 35 |
|
| 36 |
postCreate: function(){ |
| 37 |
this.inherited(arguments); |
| 38 |
this.connect(this.textbox, "onmouseup", function(){ this._mouseIsDown = false; }); |
| 39 |
this.connect(this.textbox, "onmousedown", function(){ this._mouseIsDown = true; }); |
| 40 |
this.connect(this.textbox, "onfocus", function(e){ |
| 41 |
this._onFocus(this._mouseIsDown ? "mouse" : e); |
| 42 |
this._mouseIsDown = false; |
| 43 |
}); |
| 44 |
this.connect(this.textbox, "onblur", "_onBlur"); |
| 45 |
} |
| 46 |
}); |
| 47 |
return has("dojo-bidi") ? declare("dojox.mobile.TextBox", [TextBox, BidiTextBox]) : TextBox; |
| 48 |
}); |