/** @name Edo.controls.TextInput @class @typeName textinput, text @description 文本输入框:单行/密码/多行 @extend Edo.controls.Control */ Edo.controls.TextInput = function(){ Edo.controls.TextInput.superclass.constructor.call(this); /** @name Edo.controls.TextInput#beforetextchange @event @description 文本改变前事件 @property {String} text 文本 */ /** @name Edo.controls.TextInput#textchange @event @description 文本改变事件 @property {String} text 文本 */ /** @name Edo.controls.TextInput#textfocus @event @domevent @description 输入框获得焦点 */ /** @name Edo.controls.TextInput#textblur @event @domevent @description 输入框失去焦点 */ }; Edo.controls.TextInput.extend(Edo.controls.Control,{ _htmltype: 'text', _mode: 'text', lineHeight: true, //true(跟realHeight一样), false,不设置, 具体值30... /** @name Edo.controls.TextInput#defaultWidth @property @default 100 */ defaultWidth: 100, /** @name Edo.controls.TextInput#minWidth @property @default 20 */ minWidth: 20, defaultHeight: 21, minHeight: 20, /** @name Edo.controls.TextInput#text @property @type String @description 文本 */ text: '', /** @name Edo.controls.TextInput#readOnly @property @type Boolean @default false @description 是否只读,默认false */ readOnly: false, /** @name Edo.controls.TextInput#selectOnFocus @property @type Boolean @default false @description 是否在获得焦点的时候,选择文本.默认false */ selectOnFocus: false, textStyle: '', textCls: '', elCls: 'e-text', /** @name Edo.controls.TextInput#emptyText @property @type String @description 文本为空时的显示文本 */ emptyText: '', /** @name Edo.controls.TextInput#emptyCls @property @type String @default 'e-text-empty' @description 文本为空时的显示样式 */ emptyCls: 'e-text-empty', //disabledClass : "", focusClass: 'e-text-focus', //激发el.onchange /** @name Edo.controls.TextInput#changeAction @property @type String @default change @description 文本textchange事件由什么DOM事件激发,如change/blur/keyup/keydown等 */ changeAction: 'change', focus: function(){ //if(this.field) this.field.focus(); var el = this.field; if(this.blurTimer) { clearTimeout(this.blurTimer); this.blurTimer = null; } setTimeout(function(){ Edo.util.Dom.focus(el); },100); }, blur: function(){ var sf = this; this.blurTimer = setTimeout(function(){ Edo.util.Dom.blur(sf.field); }, 100); //if(this.field) this.field.blur(); }, getInnerHtml: function(sb){ var w = this.getFieldWidth() - 8;//8是 (1border + 3padding) * 2 var h = lh = this.realHeight - 4;//4是 (1border + 1padding) * 2 if(this.lineHeight && this.lineHeight !== true){ lh = this.lineHeight; } var text = this.text; // var text = Edo.isValue(this.text) ? this.text : this.emptyText; // this.elCls += ' ' + (text === this.emptyText ? this.emptyCls : ''); if(this._mode == 'text'){ sb[sb.length] = '