⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textitem.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 2 页
字号:
/*
 * Isomorphic SmartClient
 * Version 6.5 (2008-04-30)
 * Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 *
 * licensing@smartclient.com
 *
 * http://smartclient.com/license
 */
 //>	@class	TextItem//// FormItem for managing a text field.//// @visibility external// @example textItem//<isc.ClassFactory.defineClass("TextItem", "FormItem");isc.TextItem.addProperties({    //>	@attr	textItem.width		(number : 150 : IRW)	//			Default width for fields.	//		@group	appearance    // @visibility external	//<	width:150,		        //>	@attr	textItem.height		(number : 19 : IRW)	//			Default height for text items.	//		@group	appearance    // @visibility external	//<                                               height:isc.Browser.isSafari ? 22 : 19,    //>	@attr	textItem.textBoxStyle     (FormItemBaseStyle : "textItem" : IRW)	//  Base CSS class name for this item's input element.    // NOTE: See the +link{group:CompoundFormItem_skinning} discussion for special skinning considerations.    	// @group	appearance    // @visibility external	//<	textBoxStyle:"textItem",		    //>	@attr	textItem.length		(number : null : IRW)	//			if set, maximum number of characters for this field	//		@group	validation    // @visibility external	//<	length:null,    // whether its possible for this type of FormItem to do autoCompletion    canAutoComplete:true,	//>	@attr	textItem._elementType			(string : "TEXT" : IRW)	//			type of field (eg: "PASSWORD", "UPLOAD", etc)	//<			_elementType:"TEXT",	//>	@attr	textItem._getSizesDynamically	(boolean : true : RA)	//			Dynamically figure out field sizes for this element	//			 in Navigator so we know how to approximate its size.	//<	_getSizesDynamically:true,    //> @attr   textItem._hasDataElement    (boolean : true : IRW)    //      Text items have a data element.    // @group formValues    // @visibility   internal    // @see     method:FormItem.hasDataElement    // @see     method:FormItem.getDataElement    //<    _hasDataElement:true,        // Set flag to indicate that our data element is used as the textBox for this item.    // This flag means updateState will apply the result of this.getTextBoxStyle() to this item's    // data element - appropriate for native text boxes, text areas and selects.    _dataElementIsTextBox:true,    //> @attr   textItem.emptyStringValue   (any : null : IRW)    //      Should the empty string be mapped to null, or stored as an empty string.    //      Updated on 'setValue(null)' or 'setValue("")'    // @group formValues    // @visibility   internal    //<            _emptyStringValue:null,        // Override redrawOnShowFormIcon - we can handle dynamically updating the item's HTML to    // show / hide text item icons    redrawOnShowIcon:false,        // _nativeEventHandlers is a place to specify native event handlers to be applied to the    // form item element once it has been written into the DOM (without having to override     // '_applyHandlersToElement()'    _nativeEventHandlers : {                        onmousedown : (            isc.Browser.isIE ? function () {                var element = this,                    itemInfo = isc.DynamicForm._getItemInfoFromElement(element),                    item = itemInfo.item;                if (item) item._setupFocusCheck();                } : null        )    }        //>@attr TextItem.browserSpellCheck (boolean : null : IRWA)    // @include FormItem.browserSpellCheck    // @visibility internal    //<        //>@attr TextItem.selectOnFocus (boolean : null : IRW)    // @include FormItem.selectOnFocus    // @visibility external    //<        //>@attr TextItem.readOnly  (boolean : null : IRWA)    // Setter for the standard HTML readonly property of the input element.    // If set to true, text will be non editable (though it can still be selected and copied etc)    // @visibility internal    //<                                        });isc.TextItem.addMethods({    // _handlePaste: Handler for the native onpaste event    // this fires in IE only.    // Fires before the value is pasted into the form item, so returning false would cancel the    // paste.    // Perform update on a delay so we have the new value available from the form item element.    _handleCutPaste : function () {                // Fire change handlers on paste.                if (this.changeOnKeyPress) this._queueForUpdate();    },        // _willHandleInput()    // Can we use the "input" event in this browser / form item?    // True for Moz and Safari, but not IE. See comments near FormItem._handleInput()    _willHandleInput : function () {        return !isc.Browser.isIE;    },        // by putting 'nowrap' on the text box cell we avoid the value icon / text box appearing     // on different lines    getTextBoxCellCSS : function () {        return this._$nowrapCSS    },    // NOTE: this is here for doc generation    //>	@method textItem.keyPress		(A)	//		@group	event handling	//			event handler for keys pressed in this item	//<	//>	@method	textItem.getElementHTML()	(A)	//			output the HTML for a text field element	//		@group	drawing	//		@param	value	(string)	Value of the element [Unused because it is more reliably set by setValue].	//		@return	(HTML)	HTML output for this element	//<    _$elementStartTemplate:[        ,                   // [0] possible value icon stuff        "<INPUT TYPE=",         // [1]        ,                       // [2] this._elementType,        " NAME=",               // [3]        ,                       // [4] this.getElementName(),        " ID=",                 // [5]        ,                       // [6] this.getDataElementId(),            // We want the EH system to handle events rather than writing native            // handlers into the form item.        " handleNativeEvents=false" // [7]    ],    _$tabIndexEquals:" TABINDEX=",    _$rightAngle:">",                _$disabled:" DISABLED ",    _$native:"native",    _$autoCompleteOff:" AUTOCOMPLETE=OFF ",    _$accessKeyEquals:" ACCESSKEY=",    	getElementHTML : function (value, returnArray) {        var valueIconHTML = this._getValueIconHTML(this._value);        if (this.showValueIconOnly) return valueIconHTML;        		var template = this._$elementStartTemplate,            form = this.form,			formID = form.getID(),			itemID = this.getItemID()		;        // May be null        template[0] = valueIconHTML;		        template[2] = this._elementType;        template[4] = this.getElementName();        template[6] = this.getDataElementId();                // hang a flag on the element marking it as the data element for the        // appropriate form item.        template[8] = this._getItemElementAttributeHTML();                // At this point we're appending to the end of the template Disable spellchecker in        // Moz if appropriate so we don't get the red wavy line under email addresses etc.                         if (isc.Browser.isMoz || isc.Browser.isSafari) {            if (this.getBrowserSpellCheck()) template[template.length] = " spellcheck=true";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -